Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

log4j : stopping lower level package logging

 
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
 
If you live in a cold climate and on the grid, incandescent light can use less energy than LED. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!