This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

[Solved]Hierarchy-wide Threshold Filter Doubt [Log4j]

 
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From Log4j-The Complete Manual - Page # 25

Log4j allows you to set a hierarchy-wide threshold such that a request below the threshold is dropped regardless of the logger or its effective level. The hierarchywide threshold can be viewed as a central switch that can turn logging on or off for the entire hierarchy.


What is the meaning of 'hierarchy' in this context?

I tried below code but didn't get expected answer.
Code Snippet 1

Output
0 [main] ERROR one.two - Error1
0 [main] ERROR hello - Error2
If I comment Line1 and remove comment from Line2 then also I get the same output(except the logger name). Why it doesn't consider INFO level message?

[ December 07, 2008: Message edited by: Vishal Pandya ]
[ December 08, 2008: Message edited by: Vishal Pandya ]
 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've set the threshhold to WARN, which means you'll only see WARN and ERROR. INFO is below WARN.
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Martijn Verburg:
You've set the threshhold to WARN, which means you'll only see WARN and ERROR. INFO is below WARN.


Ya but why it is applied to all the loggers that i create. I have set threshold value to only logger1 and not logger2.

Why the threshold value is also applied to logger2?
 
Martijn Verburg
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IIRC (and hopefully Peter will see this thread and correct me if I'm wrong). The LoggerRepository is global across all loggers regardless.
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Martijn Verburg:
IIRC (and hopefully Peter will see this thread and correct me if I'm wrong). The LoggerRepository is global across all loggers regardless.

Ok now I understood it. We have one (default) repository to which all the loggers belong and if you set threshold value then it is applied to all the Logger as they all belong to same repository.
Thanks Martijn.
By the way, What is IIRC? and Who is Peter?
 
Martijn Verburg
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Vishal Pandya:
Ok now I understood it. We have one (default) repository to which all the loggers belong and if you set threshold value then it is applied to all the Logger as they all belong to same repository.
Thanks Martijn.
By the way, What is IIRC? and Who is Peter?



My sincere apologies, I should always post more clearly.

IIRC = If I Remember Correctly
Peter = The fellow Moderator on this board who also happens to know far more about Ant than I do
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
A feeble attempt to tell you about our stuff that makes us money
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!