JBoss - Logging Service – III
4 June 2008Let take an interesting example. We want to set the output from the container-managed persistence engine to DEBUG level and to redirect it to a separate file, mylog.log. Then code in log4j.xml file should read like this:
<appender name="CMP" class="org.jboss.logging.appender.RollingFileAppender"> <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/> <param name="File" value="${jboss.server.home.dir}/log/mylog.log"/> <param name="Append" value="false"/> <param name="MaxFileSize" value="500KB"/> <param name="MaxBackupIndex" value="1"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/> </layout> </appender> <category name="org.jboss.ejb.plugins.cmp"> <priority value="DEBUG" /> <appender-ref ref="CMP"/> </category>
The code above creates a new file appender and specifies that it should be used by the logger for the package org.jboss.ejb.plugins.cmp. The file appender (shown above) is set up to produce a new log file every day rather than producing a new one every time you restart
the server or writing to a single file indefinitely. Older files have the date they
were written added to the name.
Related Posts:
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: JBoss - Logging Service – III