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"?>
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.apache.log4j" />
</exclusions>
</deployment>
</jboss-deployment-structure>
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" />
</layout>
</appender>
<!-- The "category" represents the package names of your Application APIs
which we want to log -->
<category name="servlets">
<priority value="TRACE" />
</category>
<root>
<priority value="TRACE" />
<appender-ref ref="AppLogAppender" />
</root>
</log4j:configuration>
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]