You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Daniel Niklas <co...@dniklas.de> on 2008/08/05 12:43:04 UTC
FileWatchDog cannot be interrupted - missing support for webapps
Hi,
the FileWatchDog daemon can't be interrupted, the InteruptedException is
ignored. I think, it might be better to accept an interruption - here stop
observing the File.
I want to use something like DOMConfiguration#configureAndWatch() in my
webapp. I can't use this, because this would cause many daemon-threads (of
FileWatchDog). Every restart of my webapp causes a new thread and i can't
interrupt this thread!
My solution is:
- an interruptable FileWatchDog
- a ServletContextListener
- starts log4j in "contextInitialized"
- shutdown log4j in "contextDestroyed" and interrupts FileWatchDog
What do you think about this?
Best regards
Daniel
--
View this message in context: http://www.nabble.com/FileWatchDog-cannot-be-interrupted---missing-support-for-webapps-tp18828607p18828607.html
Sent from the Log4j - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: FileWatchDog cannot be interrupted - missing support for
webapps
Posted by Daniel Niklas <co...@dniklas.de>.
Hi,
Curt Arnold-3 wrote:
>
> How do you propose accessing the FileWatchdog instance to interrupt
> it? Looking at DOMConfigurator and PropertyConfigurator, they do not
> retain a pointer to the watchdog, so you would need to rely on
> Thread.enumerate() or similar and decide which threads that you want
> to interrupt.
>
You're right, the current implementation does't have a reference to
the watchdog-thread. Enumerating threads isn't a nice solution.
Perhaps the current implementation of configureAndWatch methods
can't be used in a web environment. My approach is to start this
configuring and watching when the webapp starts and stop it
when the webapp stopps. This can be done with a
ServletContextListener. Therefor i have to interupt the
watchdog-tread, otherwise there would be more than one
watchdog-thread.
Curt Arnold-3 wrote:
>
> In addition, its semantics are problematic as it incrementally processes
> the configuration file (unless you specifically set log4j.reset = true
> it just adds the new configuration to the old configuration).
>
I wonder about the semantics of processing the configuration file.
I didn't know that! Can i configure a log4j-system with many
configuration-files? Does this make sense?
Is this relevant for DOMConfiguration, too?
Best regards
Daniel
--
View this message in context: http://www.nabble.com/FileWatchDog-cannot-be-interrupted---missing-support-for-webapps-tp18828607p19045039.html
Sent from the Log4j - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: FileWatchDog cannot be interrupted - missing support for webapps
Posted by Curt Arnold <ca...@apache.org>.
log4j-dev is likely the best place for the discussion, just sometime a
discussion never catches fire for some reason. Given your initial
post was in August, vacations are a likely culprit.
How do you propose accessing the FileWatchdog instance to interrupt
it? Looking at DOMConfigurator and PropertyConfigurator, they do not
retain a pointer to the watchdog, so you would need to rely on
Thread.enumerate() or similar and decide which threads that you want
to interrupt.
Also, starting independent threads in a web container is generally
discouraged, so configureAndWatch() is problematic to begin with. In
addition, its semantics are problematic as it incrementally processes
the configuration file (unless you specifically set log4j.reset = true
it just adds the new configuration to the old configuration).
On Aug 15, 2008, at 2:06 AM, Daniel Niklas wrote:
>
> Hi,
>
> nobody with an opinion about this? Shoul'd i move this question to
> the users
> list?
>
> best regards
> Daniel
On Aug 5, 2008, at 5:43 AM, Daniel Niklas wrote:
>
> Hi,
>
> the FileWatchDog daemon can't be interrupted, the
> InteruptedException is
> ignored. I think, it might be better to accept an interruption -
> here stop
> observing the File.
>
> I want to use something like DOMConfiguration#configureAndWatch() in
> my
> webapp. I can't use this, because this would cause many daemon-
> threads (of
> FileWatchDog). Every restart of my webapp causes a new thread and i
> can't
> interrupt this thread!
>
> My solution is:
>
> - an interruptable FileWatchDog
> - a ServletContextListener
> - starts log4j in "contextInitialized"
> - shutdown log4j in "contextDestroyed" and interrupts FileWatchDog
>
> What do you think about this?
>
> Best regards
> Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: FileWatchDog cannot be interrupted - missing support for
webapps
Posted by Daniel Niklas <co...@dniklas.de>.
Hi,
nobody with an opinion about this? Shoul'd i move this question to the users
list?
best regards
Daniel
--
View this message in context: http://www.nabble.com/FileWatchDog-cannot-be-interrupted---missing-support-for-webapps-tp18828607p18994721.html
Sent from the Log4j - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org