I looked at the code and thought about this a little more.

The PropertyConfigurator and the DOMConfigurator have their own subclasses
of FileWatchdog which define the doOnChange method to instantiate that
particular configurator class and configure.  But, what if we created a new
FileWatchdog subclass called GenericFileWatchdog (or some such) that:

1) In addition to the filename and delay, you could optionally specify the
configurator class to use.
2) If no configurator class is specified, then it falls back to the same
logic used when initializing log4j from the log4j.configuration property (if
the filename ends in .xml, use the DOMConfigurator, etc).

Then, we could modify the Property and DOM configurator to handle new
settings for the watchdog.  In the DOM case, something like this:

<watchdog>
  <url name="your_url_here"/>
  <delay value="20"/> <!-- in milliseconds -->
  <configurator classname="org.apache.log4j.xml.DOMConfigurator"/>
</watchdog>

In the DOM case, we can add a parseWatchdog method that does the right
thing.

Also, some care might need to be taken in the GenericFileWatchdog to not use
the FileWatchdog constructor since it calls checkAndConfigure().  Since we
are in the middle of configuration when reading the property or dom file, I
don't think we want to have it restart the configuration...

What do folks think?

-Mark

-----Original Message-----
From: Mark Womack 
Sent: Wednesday, August 15, 2001 10:49 AM
To: 'LOG4J Users Mailing List'
Subject: RE: Specifying config file reload interval in config file
itself?


Larry, the DOMConfigurator lets you call configureAndWatch() as well.  I was
looking through the dtd, and to me there is no obvious way to specify a
reload interval.  Maybe someone more knowledgeable will speak up.

I really like this idea though.  If the functionality is not there, I think
it should be added.  Seems to me that you just need to specify settings for
a FileWatchdog object.  Of course, code would need to be added to handle the
property settings and create/make the appropriate calls.

-Mark

-----Original Message-----
From: Larry Reeder [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 15, 2001 10:18 AM
To: [EMAIL PROTECTED]
Subject: Specifying config file reload interval in config file itself?


I know you can use the log4j API call
PropertyConfigurator.configureAndWatch to set a check/reload interval for
the config file.  Is there a setting you can put in the config file that
will specify how often it should be checked for changes, so that default
initialization will check and reload the config file?

Thanks........   Larry


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to