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 "David B. Witt" <Da...@ironhilltechnology.com> on 2004/10/14 12:50:27 UTC

Appender Levels - Continued

Nicko,

I understand what you are saying.  However, when I used the code snipet you 
offered (included in my earlier e-mail), it didn't find the appender.  The 
appender variable was null after executing the code snipnet:

log4net.Appender.AppenderSkeleton appender =
(log4net.Appender.AppenderSkeleton)logger.GetAppender("myAppender");

where logger was a valid  variable gotten by executing the code snipet:

log4net.Repository.Hierarchy.Logger logger =
((log4net.Repository.Hierarchy.Logger)log4net.LogManager.GetLogger("Root").Logger);

Since the value of appender is null, how will I be able to set the 
threshold using the code snipet:

appender.Threshold = Level.Off

That is my question.

Since I am obviously brain dead on this, could you please re-post your code 
snipets to get a list of all appenders of the root logger and then show me 
show to get the name of each appender, the appender's current threshold and 
then finally how to set the appender's level to a new threshold.

Sorry to be such a pain, but I am missing something here.  Perhaps some 
brute force "drop in code" will get me over this hump.

THANKS a  MILLION for all your patience ad help in this.

Dave