Monday, April 02, 2007

How to log a class with JBoss and log4j.xml

Here's an example of how to log just one class in JBoss.

First in the Java class you want to log


Then in the log4j.xml do not add a threshold parameter to the appenders. I think it overrides all other categories. Instead add a priority value in the root logger.

<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="Target" value="System.out"/>

<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>

<category name="com.mycompany.MyClass">
<appender-ref ref="CONSOLE"/>
<priority value="DEBUG" />

<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
<priority value="INFO" />


Blogger bleeeeeeeeeeeeeee said...

Do you diflucan know--he broke out all at once--why they don't take steppes in Tartary for establishing Insane Hospitals? We both confessed ignorance.. Nothing could exceed the respect with which he greeted her as she entered his office morphine the next day.. She was barefooted, but her blue-checked gingham flonase was clean and belted smartly about a small waist.. Handsome, brilliant, wise, tender, graceful, accomplished, rich, and famous, I looked at him, without the spectacles, in surprise, digoxin and admiration, and wondered how your neighbor over the way had been so entirely untouched by his homage.. His bushy wool was amoxicillin gray--almost white...

3:18 AM  

Post a Comment

Links to this post:

Create a Link

<< Home