If your logger is just an object that needs to be available through out
your application, then you can create it in a startup servlet and then
stick it into the ServletContext with setAttribute().
If your logger is a thread that runs for the life of the application
then you can just start the thread in your startup servlet. The threads
life isn't tied to the object that created it (i think). Some app
servers don't want you creating your own threads for performance reasons
and offer schedule services as an alternative.
Lee Coomber wrote:
>
> Hi
>
> I'm developing an application that requires a Java object (a logger) to run
> for the life of the servlet engine. Currently, I just use a daemon process
> but I would like to put it into a servlet so it is easily controllable via
> a web interface.
>
> Even if I define the servlet as a startup (I'm using JServ), the problem
> occurs with the API contract that allows the engine to destroy it at any time.
>
> Can anyone think of a 'legal' way of doing this without resorting to
> playing with the unix processes (or modifying JServ, it would be nice to be
> able to use it on JRun as well)?
>
> Many thanks for any answers,
>
> Lee
>
> [ > L A T E R A L * ~ ; ] - [ [EMAIL PROTECTED] ]
>
> Phone: +44 (0) 207 378 1011
> Fax: +44 (0) 207 403 4586
> Mobile: +44 (0) 7957 368 626
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html