Re: Own Logging Handler not closing correctly

2010-08-24 Thread Mark Thomas
On 24/08/2010 10:20, pu...@web.de wrote:
 Tomcat: 6.0.29
 OS: Mac OS
 Java: 1.5
 
 
 I wrote an own java.util.logging.Handler to get the logs over the network. 
 The handler is configured via myWebapp/WEB-INF/classes/logging.properties 
 and is working very well. The handler uses some threads to do his job. I used 
 the close()-Method to interrupt them. But when shutting tomcat down or doing 
 an undeploy I always get messages like this:
 
 ---
 23.08.2010 23:43:14 org.apache.catalina.loader.WebappClassLoader 
 clearReferencesThreadsSEVERE: The web application [/testWebapp] appears to 
 have started a thread named [Thread-2] but has failed to stop it. This is 
 very likely to create a memory leak.
 23.08.2010 23:43:14 org.apache.catalina.loader.WebappClassLoader 
 clearReferencesThreadsSEVERE: The web application [/testWebapp] appears to 
 have started a thread named [Thread-2] but has failed to stop it. This is 
 very likely to create a memory leak.
 ---
 
 Theses threads were started by the handler and can not be stopped by tomcat. 
 Interestingly the cose()-Methode of my handler - where the handler would kill 
 these threads - gets called after theses messages...
 
 I don't really know how to understand these messages? Why are theses messages 
 produced before calling the close() Method of the handler?

It is to do with the order in which the context is shut down. The check
for threads is made before the logging system is shut down.

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Own Logging Handler not closing correctly

2010-08-24 Thread pue85
On 24/08/2010 10:20, pu...@web.de wrote:
 Tomcat: 6.0.29
 OS: Mac OS
 Java: 1.5
 
 
 I wrote an own java.util.logging.Handler to get the logs over the network. 
 The handler
is configured via myWebapp/WEB-INF/classes/logging.properties and is working 
very well.
The handler uses some threads to do his job. I used the close()-Method to 
interrupt them.
But when shutting tomcat down or doing an undeploy I always get messages like 
this:
 
 ---
 23.08.2010 23:43:14 org.apache.catalina.loader.WebappClassLoader 
 clearReferencesThreadsSEVERE:
The web application [/testWebapp] appears to have started a thread named 
[Thread-2] but has
failed to stop it. This is very likely to create a memory leak.
 23.08.2010 23:43:14 org.apache.catalina.loader.WebappClassLoader 
 clearReferencesThreadsSEVERE:
The web application [/testWebapp] appears to have started a thread named 
[Thread-2] but has
failed to stop it. This is very likely to create a memory leak.
 ---
 
 Theses threads were started by the handler and can not be stopped by tomcat. 
 Interestingly
the cose()-Methode of my handler - where the handler would kill these threads - 
gets called
after theses messages...
 
 I don't really know how to understand these messages? Why are theses 
 messages produced
before calling the close() Method of the handler?

It is to do with the order in which the context is shut down. The check
for threads is made before the logging system is shut down.

Mark

Thanks Mark. Do you have any idea how to do better?

I plan to offer the handler as part of a logging framework, but these 
SEVERE-Messages are not that nice and could let the useres think anything goes 
wrong...

Daniel
___
GRATIS für alle WEB.DE Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Own Logging Handler not closing correctly

2010-08-24 Thread Caldarale, Charles R
 From: pu...@web.de [mailto:pu...@web.de]
 Subject: Re: Own Logging Handler not closing correctly
 
 Do you have any idea how to do better?

Can you stop the threads with the contextDestroyed() method of a 
SevletContextListener?  That's where auxiliary thread management is expected to 
be done.

 - Chuck



THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.



RE: Own Logging Handler not closing correctly

2010-08-24 Thread pue85
Can you stop the threads with the contextDestroyed() method of a 
SevletContextListener?  That's where auxiliary thread management is expected 
to be done.

- Chuck

I was thinking about that. But that's not really what I want. Anybody should be 
able to use the handler without doing extra things in their webapps... Later 
users should be able to integrate the handler in their tomcat-installation. So 
it's no option to tell them to manually kill the threds in their contextes... 
Or is there any way I just don't know to do that generic? From within the 
handler?

If I'm right, this must be a problem anybody has if writing an own handler 
using threads...

Thanks!
Daniel
___
WEB.DE DSL SOMMER-SPECIAL: Surf  Phone Flat 16.000 für 
nur 19,99 ¿/mtl.!* http://web.de/DSL-Doppel-Flatrate/

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Own Logging Handler not closing correctly

2010-08-24 Thread Caldarale, Charles R
 From: pu...@web.de [mailto:pu...@web.de]
 Subject: RE: Own Logging Handler not closing correctly
 
 Anybody should be able to use the handler without doing extra 
 things in their webapps...

I'm not sure that's a reasonable assumption, since you have the log handler 
established within a single webapp environment.  Some interaction with the 
webapp is required.  Note that code changes to an existing webapp would not be 
required; you can supply an additional, log-handler specific 
ServletContextListener class to be configured in WEB-INF/web.xml that won't 
disturb or interact with any existing listeners the webapp might have.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.



Re: Own Logging Handler not closing correctly

2010-08-24 Thread Pid
On 24/08/2010 14:35, Caldarale, Charles R wrote:
 From: pu...@web.de [mailto:pu...@web.de]
 Subject: RE: Own Logging Handler not closing correctly

 Anybody should be able to use the handler without doing extra 
 things in their webapps...
 
 I'm not sure that's a reasonable assumption, since you have the log handler 
 established within a single webapp environment.  Some interaction with the 
 webapp is required.  Note that code changes to an existing webapp would not 
 be required; you can supply an additional, log-handler specific 
 ServletContextListener class to be configured in WEB-INF/web.xml that won't 
 disturb or interact with any existing listeners the webapp might have.

In Servlet 3.0 you could annotate the class / use a web-fragment, so you
wouldn't have to add anything to the main web.xml.


p

  - Chuck
 
 
 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
 MATERIAL and is thus for use only by the intended recipient. If you received 
 this in error, please contact the sender and delete the e-mail and its 
 attachments from all computers.
 



0x62590808.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature