to set my log4j correctly in the classpath, I did 2 things:
1) I set the name log4j to use as follows
-Dlog4j.configuration=fox-log4j.xml
it should be in CLASSPATH
2) I call the registration manager explicitly, otherwise jboss log4j does not work
this gives in my run.conf:
#parameter used by the JVM and call later in the log4j.xml LOG_FOLDER=$DIRNAME/../server/default/log
now part of my log4j:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <appender name="FOX_LOG" class="org.apache.log4j.RollingFileAppender"> <param name="Threshold" value="DEBUG"/> <param name="Append" value="true"/> <param name="MaxFileSize" value="25MB"/> <param name="MaxBackupIndex" value="5"/> <param name="File" value="${LOG_FOLDER}/fox.log"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{ISO8601} %-15x %t %-5p %-50.50c{1} - %m%n"/> </layout> </appender> <category name="com.mycompany" additivity="true"> <priority value="DEBUG"/> <appender-ref ref="FOX_LOG"/> </category> <root> <priority value="INFO"/> <appender-ref ref="FILE"/> </root> </log4j:configuration>
hope this can help. considers
user1593705
source share