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:57:04 GMT
To enable log4net internal debugging in a web project add the
log4net.Internal.Debug key to the appSettings block in your Web.config
file, e.g.:

<configuration>
  <appSettings>
    <add key="log4net.Internal.Debug" value="true"/>
  </appSettings>

  ... other configuration here ...
</configuration>

If you are developing in VS 2003 on your local machine then just run
your WebApp in the debugger. The debug output from log4net will be
written to Output->Debug window. Log4net messages are prefixed with
'log4net:' in the output.

If you are not using VS 2003 or are not running the WebApp on your local
machine then you need use the DebugView tool from sysinternals to
capture the output. http://www.sysinternals.com/utilities/debugview.html

Restart you app while DebugView is running (and capturing) on the same
machine. The debug about from log4net will be captured by DebugView.

Cheers,
Nicko

> -----Original Message-----
> From: Jason Goldsmith [mailto:JGoldsmith@psmic.com] 
> Sent: 17 August 2005 13:40
> To: Log4NET User
> Subject: RE: Cannot switch between logging levels
> 
> Ok, I've attempted to enable internal debugging to no avail.  
> I just don't understand Why switching from one log level to 
> another works when I have root as FileAppender, but doesn't 
> work when root is set to ADONetAppender.  Any thoughts?  
> 
> If any of my code is necessary, please let me know.  I have, 
> however, provided snippets (in my first email to the group) 
> of my web.config, log4net.config, global.asax.cs, AssemblyInfo.cs.
> 
> Thanks again,
> 
>  
> Jason Goldsmith
> Solution Stream
> 1510 N.Elms Road
> Flint MI, 48532
> Phone: 810.600.3913
>  
> 
> -----Original Message-----
> From: Nicko Cadell [mailto:nicko@neoworks.com]
> Sent: Wednesday, August 17, 2005 8:01 AM
> To: Log4NET User
> Subject: RE: Cannot switch between logging levels
> 
> 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