• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Log4j logs debug into info...

 
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey!

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
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
We don't have time to be charming! Quick, read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic