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:
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.
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.
posted 8 years ago
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" ?
You may have just won ten million dollars! Or, maybe a tiny ad.