Home
My Page
Projects
deegree

[#1939] Deegree 3 - Trouble with LogManager shutdown in the OGCFrontController class

Date:
2011-03-21 11:18
Priority:
3
State:
Open
Submitted by:
Didier Earith (earith)
Assigned to:
Nobody (None)
Hardware:
None
Operating System:
None
Version:
None
Severity:
major
Resolution:
None
 
URL:
Component:
CSW
SOS
WCS
WFS
WMS
WPS
 
Summary:
Deegree 3 - Trouble with LogManager shutdown in the OGCFrontController class

Detailed description
Hi,



Hi,



In OGCFrontController class, the LogFactory.releaseAll() and LogManager.shutdown() calls may raise trouble if multiple web-applications are deployed on the same Servlet Container (e.g. Tomcat).



We are using multiple web-application in a web.xml whose one is based on deegree.



When Tomcat is shutting down, the 'destroy' function of the servlets is called. In the 'destroy' function of deegree, 'Logger' objects are released. The problem is that 'Log4j' objects are shared and thus the objects are no longer available to other servlets.



Other web-applications are no longer able to log anything when LogManager.shutdown is called.





To avoid this issue, we usually put Log4j initialization and release in a listener (like Spring's Log4jConfigListener) that implements ServletContextListener interface . In this way, Log4j is initialized on Tomcat intialization (before all web-applications initialization ) and released on Tomcat release (after all web-applications release).



Would it be possible to remove the calls to LogFactory.releaseAll() and LogManager.shutdown() in the 'plugClassLoaderLeaks' function (OGCFrontController class) and promote the use a Log4j listener ?



Best regards,



Didier

Followup

Message
Date: 2011-03-21 14:23
Sender: Didier Earith

Ok. The flag in the controller configugation suits us to solve the issue.

Thanks.

Didier.
Date: 2011-03-21 12:17
Sender: Andreas Schmitz

The problem here is that not shutting down log4j properly leads to so called class loader leaks when an application is redeployed/restarted. Removing this call would solve your problem, but will result in class loader leaks for people not using Spring or another context listener.

I've added a configuration flag for the main.xml config file (controller options, in the 3.1 series) which you can use to prevent these calls from happening. Be aware, though, that this may cause PermGen space problems when you reload your deegree context multiple times.

Attached Files:

Changes:

No Changes Have Been Made to This Item


This site is hosted by Intevation GmbH