Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Log4J Filters

 
Karthik Vijayarajan
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to understand some Filter configurations in log4j xml. I came across this code in my application which sounds little confusing to me.


If my understanding is right, the first filter LevelMatchFilter says that Log4j should log all requests that are at level TRACE and should not consult remaining filters. I cant quite get as why i need the second filter DenyAllFilter. Can you please throw some light? Thank you.

[ September 02, 2008: Message edited by: Karthik Vijayarajan ]
[ September 02, 2008: Message edited by: Karthik Vijayarajan ]
 
Paul Michael
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the docs of DenyAllFilter:

You can add this filter to the end of a filter chain to switch from the default "accept all unless instructed otherwise" filtering behaviour to a "deny all unless instructed otherwise" behaviour.


Hope this helps.
 
Karthik Vijayarajan
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the response.
I thought the first filter's[LevelMatchFilter] configuration establishes what the DenyAllFilter would do. The configuration doesnt seem to be posing any problems though. I guess since the LevelMatchFilter configuration returns "ACCEPT", the DenyAllFilter is not consulted at all. Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic