logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: Cannot switch between logging levels
Date Wed, 17 Aug 2005 12:01:23 GMT
To enable log4net internal debug see:

http://logging.apache.org/log4net/release/faq.html#internalDebug
 

> -----Original Message-----
> From: Jason Goldsmith [mailto:JGoldsmith@psmic.com] 
> Sent: 17 August 2005 12:52
> To: Log4NET User
> Subject: RE: Cannot switch between logging levels
> 
> Thanks for the feedback, but I had a couple of follow-up questions:
> 
> Why would switching log levels from 
> (OFF-to-DEBUG-to-ERROR-to-etc) work when using FileAppender, 
> but ADONetAppender does not.  Is it safe to assume that if it 
> works in FileAppender mode that I have everything configured 
> properly?  
> 
> If I use a separate config file (not the web.config), how can 
> I direct the application to use its appSettings values?
> 
> 
> What file is the below log text located:
> 
> log4net: ConfigureAndWatchHandler: Changed 
> [c:\inetpub\wwwroot\log4net.config]
> log4net: ConfigureAndWatchHandler: Changed 
> [c:\inetpub\wwwroot\log4net.config]
> log4net: XmlConfigurator: configuring repository 
> [log4net-default-repository] using file 
> [c:/inetpub/wwwroot/log4net.config]
> 
> Lastly, you mentioned that it looks like I'm configuring 
> log4net twice, what leads you to believe that?  I only call
> log4net.Config.DOMConfigurator.Configure() once in Application_Start.
> 
> 
> Again, any assistance is greatly appreciated.  Thank for the help.
>  
> 
> Jason Goldsmith
> 
> -----Original Message-----
> From: Ron Grabowski [mailto:rongrabowski@yahoo.com]
> Sent: Tuesday, August 16, 2005 4:32 PM
> To: Log4NET User
> Subject: Re: Cannot switch between logging levels
> 
> If you enable debugging inside of log4net: 
> 
>  <appSettings>
>   <add key="log4net.Internal.Debug" value="true" />  </appSettings>
> 
> and use ConfigureAndWatch to configure log4net, you should 
> see a message similiar to this when you make a change to your 
> log4net.config file. The text below was generated when I 
> changed the level of my root logger from ALL to OFF:
> 
> log4net: ConfigureAndWatchHandler: Changed 
> [c:\inetpub\wwwroot\log4net.config]
> log4net: ConfigureAndWatchHandler: Changed 
> [c:\inetpub\wwwroot\log4net.config]
> log4net: XmlConfigurator: configuring repository 
> [log4net-default-repository] using file 
> [c:/inetpub/wwwroot/log4net.config]
> log4net: XmlConfigurator: configuring repository 
> [log4net-default-repository] using stream
> log4net: XmlConfigurator: loading XML configuration
> log4net: XmlConfigurator: Configuring Repository 
> [log4net-default-repository]
> log4net: XmlHierarchyConfigurator: Configuration update mode [Merge].
> log4net: XmlHierarchyConfigurator: Logger [root] Level string 
> is [OFF].
> log4net: XmlHierarchyConfigurator: Logger [root] level set to 
> [name="OFF",value=2147483647].
> ...
> 
> It looks like you're configuring log4net twice. A better 
> approach may be to use your own AdoNetAppender: 
> 
> public class MyAdoNetAppender : AdoNetAppender {  protected 
> string ConnectionString  {
>   get { return base.ConnectionString; }
>   set { base.ConnectionString =
> ConfigurationSettings.AppSettings["Logger.ConnectionString"]; }  } }
> 
> Your call to configure log4net will look something like this:
> 
>  FileInfo log4netConfig = GetLog4netConfigFile();  
> log4net.Config.DOMConfigurator.ConfigureAndWatch(log4netConfig);
> 
> --- Jason Goldsmith <JGoldsmith@psmic.com> wrote:
> 
> > Hi, I have an ASP.Net application and I store many Session 
> variables, 
> > so I've created a separate config file for log4net (log4net.config) 
> > because if any change is made to the web.config file all my Session 
> > variables are blown away.  I have configured it with the following:
> 

Mime
View raw message