Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Other Open Source Projects and the fly likes Log4J Filters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Log4J Filters" Watch "Log4J Filters" New topic

Log4J Filters

Karthik Vijayarajan
Ranch Hand

Joined: Mar 13, 2005
Posts: 43
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 ]

Karthik <br />SCJP 1.4 SCWCD 1.4 SCBCD 1.3
Paul Michael
Ranch Hand

Joined: Jul 02, 2001
Posts: 697
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.

SCJP 1.2 (89%), SCWCD 1.3 (94%), IBM 486 (90%), SCJA Beta (96%), SCEA (91% / 77%), SCEA 5 P1 (77%), SCBCD 5 (85%)
Karthik Vijayarajan
Ranch Hand

Joined: Mar 13, 2005
Posts: 43
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.
I agree. Here's the link:
subject: Log4J Filters
Similar Threads
Issue in using the DatabaseServerLoginModule for encrypting the password using MD5
Log4j lose log information issue
log4j.xml for app log.
Jboss final start up message not comes up in console
Getting log4j to write to multiple log files