logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Grabowski <rongrabow...@yahoo.com>
Subject Re: Setting log levels programatically
Date Mon, 13 Aug 2007 21:08:50 GMT
The simplest way is to set the Threshold property on the repository:

 LogManager.GetRepository().Threshold = Level.Warn;

To change the level of just an individual ILogger you have to cast it from the interface into
the actual implementation:

 ((log4net.Repository.Hierarchy.Logger)(log.Logger)).Level = Level.Warn;

----- Original Message ----

From: "Maybhate, Dipty" <Dipty.Maybhate@amd.com>

To: Log4NET User <log4net-user@logging.apache.org>

Sent: Monday, August 13, 2007 3:42:46 PM

Subject: Setting log levels programatically


   I need to set the level for logging programmatically in my code.

   I see that the LogManager.GetLogger(logname).IsErrorEnabled or isDebugEnabled is a read
only property.

   Is there some way to dynamically set the levels for log?


   Thanks and Regards



    Dipty Maybhate

 Automated Precision Manufacturing Techonology

 Advanced Micro Devices





View raw message