This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
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 Issue

 
Ranch Hand
Posts: 47
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using log4j in my web application deployed on Tomcat server (Unix OS). As soon as I change the ROOT logger level to DEBUG (in log4j.xml), I am also able to see the Tomcat logs along with my web application logs in the same log file specified in the configuration file. Any ideas on this behavior?

My guess is that tomcat also uses log4j for logging and by changing the log level of the ROOT logger, it is inheriting the same.

Here's the log4j configuration file:



I am using the following code to get the particular logger:


Thanks in advance.
Ankit
 
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Define the log category explicitly for your class or the package in which that class resides. Package will be a better approach so that you can turn debug on and off at package level.

Regards,
Amit
 
Ankit Nagpal
Ranch Hand
Posts: 47
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

amit punekar wrote:Hello,
Define the log category explicitly for your class or the package in which that class resides. Package will be a better approach so that you can turn debug on and off at package level.

Regards,
Amit



Hi,

Let's assume that I have various classes in the package a.b.c and a.b.c.d, would it be correct to do the following:



I tried this approach but still getting the same results.

Regards,
Ankit
 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have always used properties file for log4j. Regardless of that did you remove "debug=true" which is applied at root level after you added entry for package "a.b" ?

Regards,
Amit
 
Catch Ernie! Catch the egg! And catch this tiny ad too:
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!