Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning 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 debug options.

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there a way I can configure log4j to allow to me do a logger.debug("....") where it would only output if it's being used in a particular patch?
I'm adding a new feature to existing code to a very large code base, and if I were to simply use logger.debug("..."), then it would be useless since there are many project that also outputs to logger.debug. I also understand that the debug could be turned on depending on packages, however, my modification spans different packages.

Is it possible to do something like logger.debug("patch1", "debugging message...")..... thus, somewhere in the configuration file, this line will only be active if I set something like debuglevel="patch1"
Otherwise, I would have to use system.out.println("patch1------------------------" + message); Then I would have to enable and disable a particular println manually, which is also tedious.

Ganon!
 
Marshal
Posts: 67289
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you do not want the logging output mixed up with other programs also writing logs, just write them to a different file.
 
ganon bie
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I clicked on the wrong button, the thumbs down! I can't change it to a tumbs up.
 
It will give me the powers of the gods. Not bad for a 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!