The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.
| Author |
Messages |
|
James Green
 |
| 06/15/2009 2:42 PM |
|
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. |
|
|
|
|
Mayne, Michael
 |
| 06/15/2009 3:16 PM |
|
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
|
|
|
|
|
James Green
 |
| 06/15/2009 3:23 PM |
|
I've actually just exposed some custom methods with adjust the eventlogappenders threashold level ... seems to work so far. Will look into the filters suggestion. Thanks,
Which part of code are you needing help with? |
|
|
|
|
|
| You are not authorized to post a reply. |
|
|
|
ActiveForums 3.7
|