Mar 12 2008
How to use log4j
Here is a simple example showing how to log using Log4j.
Mar 07 2008
Mar 05 2008
Sometimes log4j decides to log in system out in addition to whatever root appenders you might be using. This is some problem which gave me serious headaches.
So heres what is happening, log4j by default logs to the custom categories (whatever you have specified) and then root logger as well!
To prevent this you have to set the custom categories additivity to false, so that it doesn't use the root logger.
An example:
<category name="customname" additivity="false">
<priority value="DEBUG"/>
<appender-ref ref="RollingFileOutput"/>
</category>
if you are using a property file,
log4j.category.additivity.myCategory=false
where myCategory is the name of the custom category you might have created.