logging - log4net - getting appenders specific to only one logger -
i'm looking way appenders attached 1 logger instance.
i tried:
hierarchy hierarchy = logmanager.getrepository() hierarchy; hierarchy.getappenders()
as per documentation returns appenders loggers configured.
when try this:
logmanager.getlogger("myloggername").logger.repository.getappenders();
i same result.
i retrieve appenders attached 1 logger ("myloggername" in case)
where wrong?
when call following code
logmanager.getlogger("myloggername").logger.repository.getappenders();
you in fact asking exact same data hierarchy.getappenders()
because hierarchy
inherits loggerrepositoryskeleton
, implements iloggerrepository
, type returned logger.repository
.
you can list of "first level" appenders using logger
class lives in hierarchy
namespace:
var h = logmanager.getrepository() hierarchy; var l = h.getlogger("myloggername", h.loggerfactory); // l.appenders property
you have handle special cases bufefring or filtering appenders there
Comments
Post a Comment