• 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 Issue

 
Ranch Hand
Posts: 47
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic