oh, that’s simple enough…<br />
<br />
put log4j.properties in the WEB-INF/classes of my webapp.<br />
put log4j-1.2.8.jar and commons-logging-1-0-3.jar in the WEB-INF/lib of my webapp.<br />
<br />
and use a properties file that loos something like this one:<br />
### BEGIN<br />
##<br />
#<br />
<br />
# Set root logger level to DEBUG and its appenders to A1, R.<br />
log4j.rootLogger=DEBUG, A1, R<br />
<br />
#<br />
# A1 is set to be a ConsoleAppender.<br />
#<br />
log4j.appender.A1=org.apache.log4j.ConsoleAppender<br />
<br />
# A1 uses PatternLayout.<br />
log4j.appender.A1.layout=org.apache.log4j.PatternLayout<br />
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x – %m%n<br />
<br />
#<br />
# A1 is set to be a ConsoleAppender.<br />
#<br />
log4j.appender.R=org.apache.log4j.RollingFileAppender<br />
log4j.appender.R.File=myapp.log<br />
<br />
# Set the file size and the max # files to roll<br />
log4j.appender.R.MaxFileSize=100KB<br />
log4j.appender.R.MaxBackupIndex=5<br />
<br />
log4j.appender.R.layout=org.apache.log4j.PatternLayout<br />
log4j.appender.R.layout.ConversionPattern=%p %t %c – %m%n<br />
<br />
#<br />
##<br />
### END <br />
<br />
then it will work fine…<br />
<br />
so easy, so simple, so beautiful!<br />

Leave a Reply

You must be logged in to post a comment. Login »