root being set to ERROR will not block the Myclass DEBUG; the
more-specific Myclass logger setting overrides the root setting.
Have you actually tried this?
package com.pkg;
import org.apache.log4j.Logger;
import com.other.OtherClass;
public class MyClass {
static Logger logger = Logger.getL
I will try setting root level to ERROR. All the other config is as u
suggested. Will try to debug why MyClass DEBUG logs arent getting logged
when its logger level is DEBUG. Thanks for detailed description.
Jacob Kjome wrote:
>
>
> First, you are not setting the level of the appender, but tha
First, you are not setting the level of the appender, but that of the logger
which can reference any given appender, including your named "Log1" appender.
So, if you want ERROR level for all classes, then set the "root" logger level
to ERROR.
After that, you make a decision of which append
If I set the level of Log1 appender to DEBUG, then DEBUG logs of all the
classes including MyClass are getting logged. If I set it to ERROR, then
ERROR logs of all the classes including MyClass are getting logged. But what
I want is - DEBUG logs of only MyClass and ERROR of rest all. Here, my
mot
> I want MyClass logs of DEBUG level and all other classes of ERROR in
> "log1.log" file as mentioned in logger "Log1".
> ...
> whereas if I set the level in appender
> "Log1" to DEBUG, I do get the DEBUG logs of Myclass in log1.log.
If you set the level of the Log1 appender to DEBUG, you say tha
How do you define your logger in your Java code? I'm suspicious that the
logger name you've defined as "MyClass" is merely the simple name of the
class, not the fully qualified name of the class that you've likely defined it
for your logger name.
That is, if "MyClass" is in the package "com
I am out of the office until 25.06.2012.
I will respond to your message when I return.
Note: This is an automated response to your message "Re: class specific
logging level" sent on 08.06.2012 17:02:52.
This is the only notification you will receive while this person is away.
Hi,
I have tried it with the following configuration :
I want MyClass logs of DEBUG level and all other classes of ERROR in
"log1.log" file as mentioned in logger "Log1". B
What I've provided does exactly what you are asking for. Setting your class
logging level to DEBUG overrides the inherited level from root for the
specified logger name. Why don't you just try it and see what it does rather
than speculate on why you believe it wouldn't work? You can also re