How to programmatically find an appender for a logger?

Hi all, I have a custom appender and sometimes I want to change its configuration at runtime. I would expect that the appenders are inherited in the same way as the log level. So when I get a Logger for "com.mycompany.foo" and ask for the log level, and I've specified the log level only for the root logger, then I get this log level. But when I ask the same logger for a specific appender (via myLogger.getAppender("myAppender")) and the appender is referenced by the root logger, then I get nothing. It seems that I have to know which logger references the appender. To me this doesn't seem right. Where is my mistake? If I could access the parent logger, then I might climb up the hierarchy and ask the parent loggers for the appender. But I also haven't found a method to get the parent logger. Regards, Johannes ________________________________ Firma: Capgemini Deutschland GmbH Gesch?ftsf?hrer: Dr. Michael Schulte (Sprecher) * Dr. Uwe Dumslaff * Josef Ranner Aufsichtsratsvorsitzender: Antonio Schnieder Amtsgericht Berlin-Charlottenburg, HRB 98814 This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

Hi all, anybody with an idea? I apologize for my impatience. :) Btw: Is there a way to access an appender directly, without a logger? Regards, Johannes Von: Logback-user [mailto:logback-user-bounces@qos.ch] Im Auftrag von Konstantinidis, Johannes Gesendet: Donnerstag, 18. April 2013 19:18 An: logback-user@qos.ch Betreff: [logback-user] How to programmatically find an appender for a logger? Hi all, I have a custom appender and sometimes I want to change its configuration at runtime. I would expect that the appenders are inherited in the same way as the log level. So when I get a Logger for "com.mycompany.foo" and ask for the log level, and I've specified the log level only for the root logger, then I get this log level. But when I ask the same logger for a specific appender (via myLogger.getAppender("myAppender")) and the appender is referenced by the root logger, then I get nothing. It seems that I have to know which logger references the appender. To me this doesn't seem right. Where is my mistake? If I could access the parent logger, then I might climb up the hierarchy and ask the parent loggers for the appender. But I also haven't found a method to get the parent logger. Regards, Johannes ________________________________ Firma: Capgemini Deutschland GmbH Geschäftsführer: Dr. Michael Schulte (Sprecher) * Dr. Uwe Dumslaff * Josef Ranner Aufsichtsratsvorsitzender: Antonio Schnieder Amtsgericht Berlin-Charlottenburg, HRB 98814 This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

Hi Johannes, I think the fact that you cannot fetch all the appenders registered/active in system is a shortcoming in the API. You are also correct to point out that one cannot easily obtain the parent of a logger. Please create a jira issue requesting these operations be added. TIA, On 23.04.2013 12:32, Konstantinidis, Johannes wrote:
Hi all,
anybody with an idea?
I apologize for my impatience. J
Btw: Is there a way to access an appender directly, without a logger?
Regards,
Johannes
*Von:*Logback-user [mailto:logback-user-bounces@qos.ch] *Im Auftrag von *Konstantinidis, Johannes *Gesendet:* Donnerstag, 18. April 2013 19:18 *An:* logback-user@qos.ch *Betreff:* [logback-user] How to programmatically find an appender for a logger?
Hi all,
I have a custom appender and sometimes I want to change its configuration at runtime.
I would expect that the appenders are inherited in the same way as the log level. So when I get a Logger for "com.mycompany.foo" and ask for the log level, and I've specified the log level only for the root logger, then I get this log level. But when I ask the same logger for a specific appender (via myLogger.getAppender("myAppender")) and the appender is referenced by the root logger, then I get nothing. It seems that I have to know which logger references the appender.
To me this doesn't seem right. Where is my mistake?
If I could access the parent logger, then I might climb up the hierarchy and ask the parent loggers for the appender. But I also haven't found a method to get the parent logger.
Regards,
Johannes
------------------------------------------------------------------------
-- Ceki 65% of statistics are made up on the spot
participants (2)
-
ceki
-
Konstantinidis, Johannes