logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shireesh Thanneru <thann...@yahoo.com>
Subject RE: How to get the log level and other config info programmatically
Date Fri, 04 Nov 2005 13:43:03 GMT
Thank you! Perhaps, this can be included in the FAQs. How do I contribute to the documentation?


Nicko Cadell <nicko@neoworks.com> wrote:
To get the level of your logger:

((log4net.Repository.Hierarchy.Logger)logger.Logger).Level 

to get the level of the logger:

((log4net.Repository.Hierarchy.Logger)log.Logger).Hierarchy.Root.Level

Cheers,
Nicko


> -----Original Message-----
> From: Shireesh Thanneru [mailto:thanneru@yahoo.com] 
> Sent: 04 November 2005 03:35
> To: log4net-user@logging.apache.org
> Subject: Re: How to get the log level and other config info 
> programmatically
> 
> Can some one answer this question? Does Log4Net expose config 
> information through APIs? 
> 
> Shireesh Thanneru wrote: 
> 
> How do I get the current log level and other config 
> info programmatically? The ILogger interface does not define 
> any methods or properties to do this. 
> 
> More specifically, if I have a logger like this:
> 
> private static readonly ILog logger = 
> LogManager.getLogger(typeof(MyClass));
> 
> 
> 
> How do I find out the log level of this logger (as set 
> in the config file) and also the log level of the root 
> logger? logger.IsInfoEnabled, etc. will suffice in most 
> cases, but how do I find out what is the exact log level that 
> is specified in the config file?
> 
> 
> 
> Thanks,
> 
> 
> 
> Shireesh Thanneru
> 
> 

Mime
View raw message