This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

log4j : stopping lower level package logging  RSS feed

 
Roger manning
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!