There is no way of generally hooking the log4net internal logging
(LogLog). As Ron suggests it would be possible to write a trace listener
that loos for the log4net warn and error prefixes.

Each appender uses an ErrorHandler object to report errors. This is
configured using the ErrorHandler property on the appender in the config
file. The default ErrorHandler is log4net.Util.OnlyOnceErrorHandler
which passes the error on the LogLog.Error method. It would be possible
to write a custom IErrorHandler which logs to the event log, however
this will not capture errors that do not occur in an appender and the
ErrorHandler is not used to report non-Error events.

Ideally the internal debug and error logging needs to be made pluggable.
There is an effort in log4j to use log4j appenders to manage internal
logging s well - sort of self hosting logging! I'm not sure how this has
worked out for them.

Nicko 

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: 09 June 2005 08:08
> To: log4net-user@logging.apache.org
> Subject: Re: logging log4net exceptions to event log
> 
> Thanks for the reply Nicko. First I would clarify that I 
> meant internal errors within log4net framework. My 
> requirement is that if there is any internal error within 
> log4net then that should be logged to event log. 
> 
> I am aware of the log4net.internal.debug setting but that 
> logs not only errors but other Debug level messages as well. 
> When my application is in production, I would like to 
> configure log4net to log only internal errors and not other 
> internal Debug messages.When I need to diagnose a log4net 
> problem I would like to increase the level of logging from 
> "Error" to "Debug". So can I configure the level of logging 
> for log calls within log4net? 
> 
> Thanks,
> Hemant 
> 
> 

Reply via email to