log4net - getting appenders specific to only one logger

Posted by andreav on Stack Overflow See other posts from Stack Overflow or by andreav
Published on 2014-08-18T13:27:33Z Indexed on 2014/08/19 10:20 UTC
Read the original article Hit count: 189

Filed under:
|
|

I'm looking for a way to get all appenders attached to one logger instance.

I tried:

Hierarchy hierarchy = LogManager.GetRepository() as Hierarchy;
hierarchy.GetAppenders()

as per documentation this returns all appenders for all loggers currently configured.

When I try this:

LogManager.GetLogger("MyLoggerName").Logger.Repository.GetAppenders();

I get the same result.

I would like to retrieve only appenders attached to one logger ("MyLoggerName" in this case)

Were am i wrong?

Thank you.

© Stack Overflow or respective owner

Related posts about logging

Related posts about log4net