Hi all,
I am trying to configure log4j for logging my application in a separate file. Just like it is described in http://www.jboss.org/community/wiki/ClassLoaderScoping.
Unfortunately the logging file isn't created. What is my mistake?
I use JBoss5.1.0AS with scoped classloading for my application as defined in
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=154592#4233045
and
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=154016.
There is log4j.jar file in the WEB-INF/lib folder and the log4j.xml in the WEB-INF/classes/ folder.
log4j.xml:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="rollingFile" class="org.apache.log4j.RollingFileAppender"> <param name="File" value="c:/temp/reportal.log"/> <param name="MaxFileSize" value="10MB"/> <param name="MaxBackupIndex" value="30"></param> <param name="Threshold" value="INFO"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%p %d{HH:mm:ss,SSS} %c{1}: %m %n"/> </layout> </appender> <appender name="stdout" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%p %d{HH:mm:ss,SSS} %c{1}: %m %n"/> </layout> </appender> ... </log4j:configuration>
Use the jboss-log4j.xml file in /conf folder of your configuration of JBoss installation. Also, you should not have any log4j.jar file in lib path of your application (EAR or WAR file), otherwise messages are not logged.
Rizwan