Log4j logging in system out
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.
About this entry
You’re currently reading “Log4j logging in system out,” an entry on Quality Obsessed
- Published:
- 03.05.08 / 12pm
- Category:
- log4j
- Rate article:
Printer Friendly

No comments
Jump to comment form | comments rss [?] | trackback uri [?]