The moose likes Java in General and the fly likes Log4j logs debug into info... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Log4j logs debug into info..." Watch "Log4j logs debug into info..." New topic

Log4j logs debug into info...

Ivan Jouikov
Ranch Hand

Joined: Jul 22, 2003
Posts: 269

My log4j is set up as the following:

As you can see, there are 2 loggers: root(INFO) and debugger(DEBUG)

Whenever I use the following:

Logger.getLogger("debugger").debug("YO YO DEBUG");

, "YO YO DEBUG" gets logged into both the root logger's appender, and debugger's appender. How can this be, if I am calling debug on debugger, which is lower down the hirearchy, how can it give that message to the root logger in the first place? And even if it does give it to it - how come root logger logs it, if it's set to log on INFO?

Thanks in advance.
Ivan Jouikov
Ranch Hand

Joined: Jul 22, 2003
Posts: 269
Part of my question was answered by the doc:

"The output of a log statement of logger C will go to all the appenders in C and its ancestors"

So, ok I can change additivity and prevent it from going to the root. But still, why does root log DEBUG?
Don't get me started about those stupid light bulbs.
subject: Log4j logs debug into info...
Similar Threads
customize appenders within rootCategory
Dukes Bank and log4j error
thread safe logging in a servlet
logs of different package to be written to different logs