0 Replies Latest reply on Oct 29, 2013 11:36 AM by Adrián Córdoba

    log4j configuration in ear application

    Adrián Córdoba Newbie

      Hi there!

      I'm starting to develop an enterprise application for JBoss AS 7.1.1 Final: ear + ejb + web.

      I'm using log4j in the web module by putting "jboss-deployment-structure.xml" file in META-INF directory:


      <?xml version="1.0" encoding="UTF-8"?>




        <module name="org.apache.log4j" />





      and "log4j.xml" file in WEB-INF/classes directory:


      <?xml version="1.0" encoding="UTF-8" ?>

      <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

        <appender name="AppLogAppender" class="org.apache.log4j.DailyRollingFileAppender">

        <param name="DatePattern" value="'.'yyyy-MM-dd" />

        <param name="File" value="${jboss.server.log.dir}/MyApp-web.log" />

        <param name="Append" value="false" />

        <layout class="org.apache.log4j.PatternLayout">

        <param name="ConversionPattern" value="%d [%t] %p - %m%n" />



        <!-- The "category" represents the package names of your Application APIs

        which we want to log -->

        <category name="servlets">

        <priority value="TRACE" />



        <priority value="TRACE" />

        <appender-ref ref="AppLogAppender" />




      If I only deploy the web module, log4j works fine leaving the "MyApp-web.log" file in "standalone/log" directory.

      But if I deploy the ear application (ear + ejb + web), the application works fine, but no log file is generated.


      Can somebody tell me where should I put these configuration files in order to use log4j properly in the ear application?


      Thank you in advance.


      [Adrián E. Córdoba]