James,
You could try using a custom filter class that you attach to your appenders and 
that look s for the condition(s) you set for turning appending on/off.

Also, on a separate note, would you post your code for doing the logging 
programmatically? I'm trying to do the same thing for unit testing custom 
layouts, appenders and loggers.
Thanks
Michael


From: James Green [mailto:james.gr...@occam-dm.com]
Sent: 15 June 2009 13:43
To: log4net-user@logging.apache.org
Subject: Redirecting Some Log Entries

Hi All,

I'm just creating a wrapper for my use.  The question I have is about 
redirecting or temporarily turning off appenders.

Say I have two appenders added to the over all config.  One is a simple file 
appender whilst the other is an Event log appender.

Most of the time I just want things to go to the file appender and on some 
occasions I want logs to just go to the EventLog.  The config is all being 
performed in code by creating the required appenders and then calling 
ActivateOptions().

How would I go about turning them on and off selectively in code? (C#).

Cheers,

James.

Reply via email to