RE: RollingFileAppenders per Class

2009-02-11 Thread Hadley Willan
Thanks Nick, That works a charm! :) -Original Message- From: Nick Durcholz [mailto:ndur...@e-farmcredit.com] Sent: Wednesday, 11 February 2009 23:33 To: Log4NET User Subject: RE: RollingFileAppenders per Class I think what you want to do is use the logger heirarchy for this. Something

Re: Change the log level programmatically?

2009-02-11 Thread Ron Grabowski
// untested public class HierarchyLoggerLevelScope : IDisposable { private readonly Level originalLevel; private readonly Logger logger; public HierarchyLoggerLevelScope(ILog log, Level level) { logger = log.Logger as Logger; if (logger != null) {

RE: Change the log level programmatically?

2009-02-11 Thread Francine Taylor
How about something like this? private void ChangeLogLevel(string pLoggerName, Level pLogLevel) { Logger ll = SafeSearchForLogger(pLoggerName); if (ll != null) { ll.Level = pLogLevel; } } // this method looks for a named logger. If it doesn't already exist, null // is returned

RE: Change the log level programmatically?

2009-02-11 Thread Eric Rose (erose)
Thanks Nick, I'm not going to hack the log4net code, so that's not really an option. I'm asking about this, because one of the developers had asked if there was a way to do this. But, it sounds like it's not really possible, unless we want to modify the config file... So, thanks for the informat

RE: Change the log level programmatically?

2009-02-11 Thread Nick Durcholz
There isn't a clean way to do this with the interfaces provided. If you really MUST have this, you could probably hack something up, but it would require breaking some of the abstractions that the framework tries to enforce. You could also try loading the config xml into memory, modifying it u

RE: Change the log level programmatically?

2009-02-11 Thread Eric Rose (erose)
Hi, I sent this question a couple of weeks ago, but haven't heard any feedback from anyone... Could someone offer some suggestions here, or let me know that this can't be done?! Thanks, -esr From: Eric Rose (erose) Sent: Friday, January 30, 2009 10:22 PM To: log4net-user@logging.apache.org

RE: RollingFileAppenders per Class

2009-02-11 Thread Nick Durcholz
I think what you want to do is use the logger heirarchy for this. Something like the following will work: ... ... ... The key here is the additivity="false" attribute on MyNamespace.StaticClassX logger. This indicates that