You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Dean Fiala <df...@celadonlabs.com> on 2005/08/09 20:10:51 UTC

Getting Appenders At Runtime

How do you get the active appenders at runtime?  I apologize for a basic
question, but an hour of googling and manual reading have led to nada.

I'm working in 1.2.0-Beta8.

I'm doing a DOM configuration with a simple rolling file appender set at
root, named "RollingFile". I am able to successfully log. However, I cannot
figure out how to grab a reference to the appender, which would be useful
for debugging.

I've done this:
 Dim log As ILog = LogManager.GetLogger("root")
 Dim connectionAppender As IAppenderAttachable = log.Logger
 Dim app As RollingFileAppender =
connectionAppender.GetAppender("RollingFile")

But app always = nothing, and the connectionAppender.Appenders collection is
always empty.

Any clues, hints, or suggestions would greatly appreciated.