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: [email protected] Subject: Change the log level programmatically? Hopefully this is an easy question which has already been asked (and answered) before. I searched online, but could not find a reasonable answer... Is there a way to change the default log level of a logger via C# program control? I don't need the setting to persist, so I don't want to have to change the XML config file and re-read it. In my C# code, I have a ILog variable that we use for all logging, defined as follows: private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMeth od().DeclaringType); I'd like to be able to somehow be able to use that 'log' variable, and set it's log level (INFO, WARN, ERROR, OFF, ALL, etc) to whatever I want in the code. Any help or pointers to useful examples would be appreciated! Thanks, -esr Eric Rose Software Engineer Product Development
[email protected] <mailto:[email protected]> Phone :(978) 936-1858 Cisco Systems, Inc. 500 Beaver Brook Road Boxborough, MA 01719 www.cisco.com <http://www.cisco.com>
<<image001.gif>>
