Friday, May 18, 2012
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.

Subject: log4net stops logging for apparently no reason
Prev Next
You are not authorized to post a reply.

Author Messages
Seth Milder

05/15/2008 6:34 PM  

Hi,

I was very happy with log4net. Kudos to the developers. However, one
day, it inexplicably and silently stopped logging.  We are using log4net
for our internal SharePoint applications, in case this makes any difference.

Here are the relevant parts of my web. config (this has changed a bit
since I've been mucking about with it):

<configuration>
  <configSections>
     ...
     <section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"
requirePermission="false" />
   </configSections>
  ...
  <log4net>
    <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
      <param name="File" value="C:\Program Files\Common Files\Microsoft
Shared\web server extensions\12\LOGS\apps.log" />
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
      </layout>
    </appender>
    <root>
      <level value="DEBUG" />
      <appender-ref ref="LogFileAppender" />
    </root>
 </log4net>
</configuration>

I turned on internal logging and I get this:

log4net: DefaultRepositorySelector: Assembly [XXX.YYY.ZZZ,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx] using
repository [log4net-default-repository] and repository type
[log4net.Repository.Hierarchy.Hierarchy]
log4net: DefaultRepositorySelector: repository
[log4net-default-repository] already exists, using repository type
[log4net.Repository.Hierarchy.Hierarchy]
log4net: DefaultRepositorySelector: Creating repository for assembly
[AAA.BBB.CCC, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=xxxxxxxxxxxxxxxx]
log4net: DefaultRepositorySelector: Assembly [AAA.BBB.CCC,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx]
Loaded From [Global Assembly Cache]
log4net: DefaultRepositorySelector: Assembly [AAA.BBB.CCC,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx] does
not have a RepositoryAttribute specified.
log4net: DefaultRepositorySelector: Assembly [AAA.BBB.CCC,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx] using
repository [log4net-default-repository] and repository type
[log4net.Repository.Hierarchy.Hierarchy]

Now another server has suffered the same fate and I am getting desperate. Can anyone help? I've googled this to no avail. Thanks for any available guidance!

Best,

Seth Milder


--
Seth Milder
AIM: sdmilder
Have something to hide? http://securepastebin.com

Seth Milder

05/15/2008 7:00 PM  

Seth Milder wrote:
> Hi,
>
> I was very happy with log4net. Kudos to the developers. However, one
> day, it inexplicably and silently stopped logging.  We are using
> log4net for our internal SharePoint applications, in case this makes
> any difference.

I fixed this right after I sent this. Someone else's assembly got
deployed that uses log4net and did not contain the proper initialization
in  AssemblyInfo.cs. It seems there is some unwritten law of nature
where I am unable to fix an issue like this until I bother some mailing
list. This then immediately leads to the solution.

Sorry to bother you.

Best,

Seth

--
Seth Milder
AIM: sdmilder
Have something to hide? http://securepastebin.com

Ron Grabowski

05/15/2008 7:11 PM  

You could leave the internal logs on for a while to try and capture the error again or you could write your own IErrorHandler and send an email when an error occurs:

public class EmailOnlyOnceErrorHandler : OnlyOnceErrorHandler
{
    public new void Error(string message, Exception e, ErrorCode errorCode)
    {
        base.Error(message, e, errorCode);
       
        // TODO: send mail
    }
}

Any appender that extends AppenderSkeleton (most of the built-in appenders including FileAppender) has an ErrorHandler property that you can set in the config file:

 <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
  <errorHandler value="Company.Logging.EmailOnlyOnceErrorHandler, Company.Logging" />
  <!-- snip -->
 </appender>

Maybe there are issues with ASP.Net spawning a new AppDomain for the application before the old AppDomain has released the exclusive lock on the file.

Seth Milder

05/16/2008 1:37 AM  

Ron Grabowski wrote:
> You could leave the internal logs on for a while to try and capture the error again or you could write your own IErrorHandler and send an email when an error occurs:
>
> public class EmailOnlyOnceErrorHandler : OnlyOnceErrorHandler
> {
>     public new void Error(string message, Exception e, ErrorCode errorCode)
>     {
>         base.Error(message, e, errorCode);
>        
>         // TODO: send mail
>     }
> }
>
> Any appender that extends AppenderSkeleton (most of the built-in appenders including FileAppender) has an ErrorHandler property that you can set in the config file:
>
>  <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
>   <errorHandler value="Company.Logging.EmailOnlyOnceErrorHandler, Company.Logging" />
>   <!-- snip -->
>  </appender>
>
> Maybe there are issues with ASP.Net spawning a new AppDomain for the application before the old AppDomain has released the exclusive lock on the file.
>  
Thanks! That is a nice tip!

--
Seth Milder
AIM: sdmilder
Have something to hide? http://securepastebin.com

You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > log4net stops logging for apparently no reason



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement