Help coderanch get a
new server
by contributing to the fundraiser
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

log4j : stopping lower level package logging

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Liar, liar, pants on fire! refreshing plug:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic