Posted comments (5)

Posted by Gustavo at December 27, 2010 14:06:32 CET
The best tutorial of Log4J!!!
Thanks!
Posted by Rits at September 22, 2011 09:26:33 CEST
Best logger inheritence tutorial.
Explained very nicely with a simple example.

Can u plz explain output, with following log4j.properties :-
==================================================================
log4j.rootLogger=WARN, stdout

# Global Threshold - overridden by any Categories below.
log4j.appender.stdout.Threshold=DEBUG

# Categories
#log4j.category.com.mobilefish=FATAL
#log4j.category.com.mobilefish.bean=INFO

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%c{1}] %M - %m%n
==================================================================

Output don't have DEBUG and INFO messages.

Thanks,
Rits
Posted by Ajith at November 9, 2011 07:44:32 CET
Sir,

I have been looking for a proper explanation for the purpose of Log4j.category for atleast few hours. This post was brilliant and gave me a pefect insight into the matter. I couldn't find such a simple way of desciribing the facts even at the Apache log4j official website.

Thanks,
Ajith
Posted by Frank at March 15, 2012 07:51:08 CET
Sorry, but is the destination not defined by

log4j.appender.stdout=org.apache.log4j.ConsoleAppender

Means the category has nothing to do with the output target.
Posted by Scott at February 2, 2022 07:25:21 CET
#11 is missing these two lines in the output:

WARN [Log4jDemo3] main - This is my warn message.
ERROR [Log4jDemo3] main - This is my error message.