File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes log4j : stopping lower level package logging 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 : stopping lower level package logging" Watch "log4j : stopping lower level package logging" New topic
Author

log4j : stopping lower level package logging

Roger manning
Greenhorn

Joined: May 02, 2011
Posts: 6
Hi,

Best description of my problem is by example :-
* I have 2 packages : 'A' and 'childOfA' and the package structure is as follows :-
com.mycompany.A.childOfA
* package A contains many classes and other packages that I want to log at DEBUG level
* childOfA contains lots of debug level logging which is swamping my log files
* my root logger is set to log at INFO

What I want to do is enable logging for package A and all of it's sub packages at DEBUG level but exclude just childOfPackageA from this, and either stop logging for that package or get it to log at a higher level (eg. INFO), or to a different file.
I have no access to the code thus can't change any of this programmatically (eg. changing logging statements in childOfA to TRACE level, etc) thus need to do it through log4j.properties
I've tried this :-
log4j.logger.com.mycompany.A=debug
log4j.logger.com.mycompany.A.childOfA=info

but from what I've read on log4j docs, because the first statement is essentially the filter at the higher level, child of A's DEBUG level logging is still appearing in my log files and my second statement is effectively redundant

Anybody have any ideas how I can accomplish what I need?

Cheers
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: log4j : stopping lower level package logging