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" <[EMAIL PROTECTED]>

To: Log4NET User <[email protected]>

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

Subject: Setting log levels programatically



Hi

   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

   

    

   

  







Reply via email to