Hi,
We've done the servlet that reloads the log4j thing in the past: it works well, and 
there's one for your use in the log4j-sandbox.

In the J2EE Spec world (which as others point out has serious limitations in this 
area), the thread creation itself is just as much a problem as the lack of a shutdown 
method.  It's simply against the spec, so technical if you do it your app isn't 
J2EE-compliant ;)  Of course, in practice everyone does it all the time in all the 
containers, but the user originally did ask for the strict spec take on this.

Ceki's absolutely right that the lack of a clean shutdown for configureAndWatch leads 
to bad situations with webapp reloads: we see such questions posted almost daily on 
the tomcat mailing lists.  One suggested solution is to take log4j's watchdog class 
(in the helper package), extend it with a nice shutdown method, and keep a referece to 
it in your ServletContextListener.  Then you can at least shut it down cleanly and not 
affect webapp reloads.

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: Ceki G�lc� [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, June 15, 2004 7:36 AM
>To: Log4J Users List
>Subject: Re: configureAndWatch
>
>At 01:31 PM 6/16/2004, you wrote:
>>Hi Ceki,
>>
>>Is there any other way, we can dynamically reload the properties file in a
>>J2EE app,
>
>A good way is to write a servlet that reloads the log4j config when called.
>
>>Regards..
>>
>>----- Original Message -----
>>From: "Ceki G�lc�" <[EMAIL PROTECTED]>
>>To: "Log4J Users List" <[EMAIL PROTECTED]>
>>Sent: Tuesday, June 15, 2004 2:49 PM
>>Subject: RE: configureAndWatch
>>
>>
>>
>>Yoav,
>>
>>The problem is not the thread itself, but the fact that once started it
>>cannot be stopped until the JVM exits. configureAndWatch does not provide
>a
>>means to close the thread. Imagine the problems when the web-app is
>>recycled and you have multiple configureAndWatch threads running amok. It
>>does not make a pleasant sight.
>>
>>HTH,
>>
>>At 04:24 PM 6/14/2004, you wrote:
>>
>> >Hi,
>> >Read the J2EE Specification guidelines on spawning user threads within a
>> >container to understand why.  configureAndWatch spawns a thread, albeit
>a
>> >daemon, to watch the file.
>> >
>> >Yoav Shapira
>> >Millennium Research Informatics
>> >
>> >
>> > >-----Original Message-----
>> > >From: Adrian Beech [mailto:[EMAIL PROTECTED]
>> > >Sent: Friday, June 11, 2004 7:35 PM
>> > >To: 'Log4J Users List'
>> > >Subject: RE: configureAndWatch
>> > >
>> > >G'day,
>> > >
>> > >Could you possibly explain as to why this is so?
>> > >
>> > >AB
>> > >
>> > >
>> > >-----Original Message-----
>> > >From: Ceki G�lc� [mailto:[EMAIL PROTECTED]
>> > >Sent: Saturday, 12 June 2004 5:25 AM
>> > >To: Log4J Users List
>> > >Subject: Re: configureAndWatch
>> > >
>> > >
>> > >Hello Mike,
>> > >
>> > >It is *not* OK to use configureAndWatch in a web-app.
>> > >
>> > >At 09:09 PM 6/11/2004, you wrote:
>> > >
>> > >
>> > >>Is it OK to use configureAndWatch in a Servlet?
>> > >>
>> > >>Mike
>> > >
>> > >--
>> > >Ceki G�lc�
>> > >
>> > >      For log4j documentation consider "The complete log4j manual"
>> > >      ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
>> > >
>> > >
>> > >
>> > >---------------------------------------------------------------------
>> > >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]
>> >
>> >
>> >
>> >
>> >This e-mail, including any attachments, is a confidential business
>> >communication, and may contain information that is confidential,
>> >proprietary and/or privileged.  This e-mail is intended only for the
>> >individual(s) to whom it is addressed, and may not be saved, copied,
>> >printed, disclosed or used by anyone else.  If you are not the(an)
>> >intended recipient, please immediately delete this e-mail from your
>> >computer system and notify the sender.  Thank you.
>> >
>> >
>> >---------------------------------------------------------------------
>> >To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>--
>>Ceki G�lc�
>>
>>       For log4j documentation consider "The complete log4j manual"
>>       ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
>>
>>
>>
>>---------------------------------------------------------------------
>>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]
>
>--
>Ceki G�lc�
>
>      For log4j documentation consider "The complete log4j manual"
>      ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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

Reply via email to