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