logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Grabowski <rongrabow...@yahoo.com>
Subject Re: How do you stop watching a configuration file?
Date Tue, 23 Aug 2005 00:25:51 GMT
This is an interesting requirement. I don't think this falls within the
scope of a logger. By that, I mean I don't think log4net needs an
option to specify how how long it should watch its config file. I think
its generally accepted that when you call ConfigureAndWatch you want to
watch the config file indefinitely. If you need other functionality, I
think you need to use your own code to do this. The code in
ConfigureAndWatchHandler is a good starting point. The guts of the
class are only about 15 lines long. That's a neat little class by the
way...its sort of a DelayedFileSystemWatcher.

Should there be another overload for Configure that accepts a FileInfo
and a delegate for when the config file changes? Probably not. Once
you're inside the pre-reset delegate what would you do? I suppose you
could log that the logger is going to reset itself but that's too much
logging even for me :)

My two cents,
Ron

--- "Wanner, Nick" <nwanner@zolldata.com> wrote:

> I am using log4net to log an application that has multiple clients.
> Each client by default is using a single  configuration file.  I am
> trying to change the configuration file that a particular client is
> using at runtime.  This is so I can set the logging level to a low
> level
> without affecting the runtime performance of the other clients and to
> prevent someone from accidentally turning logging off for the other
> clients.  I am able to do this using the ConfigureAndWatch method but
> I
> can't stop log4net from watching the original configuration file.  So
> whenever either file is modified, log4net is reconfigured.
> 
> How can I remove the FileSytemWatcher from the first file so that it
> will only watch the second file?
> 
> I have looked through the log4net code and it appears that the
> FileSystemWatcher is created but is not referenced in any classes so
> I
> can not Disable to Dispose it.
> 
> I am using version 1.2.0.30716 of log4net.
> 
> Thanks,
> Nick
> 


Mime
View raw message