On Feb 19, 2008, at 12:18 PM, icet wrote:


Hello, I activated logging for my class, and suddenly all of its supperclass messages are being logged as well! I belive this is the expected behaviour,
but can I disable this?

My class
public class ExampleA extends ExampleB {
private static final Logger logger = Logger.getLogger(ExampleA.class);
}

Extended class (from a library I cannot change)
public class ExampleB {
    protected final Log logger = LogFactory.getLog(getClass());
}



Both you and your super class are currently logging to the same logger. You are free to change the name of your logger and that way you can isolate the inherited log requests from the ones local to the class. Something like:

public class ExampleA extends ExampleB {
private static final Logger logger = Logger.getLogger("com.example.ExampleA.local");
}

That way if you enable "com.example.ExampleA", you get the messages from both the superclass and derived class and if you enable "com.example.ExampleA.local" you only get the derived class.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to