JBoss - Logging Service – III

4 June 2008

Let 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.

del.icio.us:JBoss - Logging Service – III  digg:JBoss - Logging Service – III  spurl:JBoss - Logging Service – III  wists:JBoss - Logging Service – III  simpy:JBoss - Logging Service – III  newsvine:JBoss - Logging Service – III  blinklist:JBoss - Logging Service – III  furl:JBoss - Logging Service – III  reddit:JBoss - Logging Service – III  fark:JBoss - Logging Service – III  blogmarks:JBoss - Logging Service – III  Y!:JBoss - Logging Service – III  smarking:JBoss - Logging Service – III  magnolia:JBoss - Logging Service – III  segnalo:JBoss - Logging Service – III  gifttagging:JBoss - Logging Service – III

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

Leave a Reply