Bug 50201 - StandardEngine.defaultAccessLog may become stale when ROOT webapp is redeployed
StandardEngine.defaultAccessLog may become stale when ROOT webapp is redeployed
Product: Tomcat 6
Classification: Unclassified
Component: Catalina
PC Windows XP
: P2 normal (vote)
: default
Assigned To: Tomcat Developers Mailing List
Depends on:
  Show dependency tree
Reported: 2010-11-02 19:28 UTC by Konstantin Kolinko
Modified: 2011-01-07 13:26 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kolinko 2010-11-02 19:28:12 UTC
In tc6.0.x-dev after r1030188 (will be 6.0.30) and in TC 7.0.4:

The method StandardEngine.logAccess(..) performs lookup of a default AccessLog implementation and caches it as StandardEngine.defaultAccessLog.  This value is not updated if the default host or its ROOT webapp are changed.  The most important use case here is when the ROOT webapp is redeployed or restarted.

To reproduce:
1. Configure an access log valve in the ROOT webapp. Remove access log valves from Engine and Host if there are any.
2. Start Tomcat and do some malformed request
3. Undeploy and redeploy the ROOT webapp.
E.g. rename ROOT -> ROOT1, wait until undeployment happens and rename it back.
4. Do some malformed request.
Expected behaviour: the request has to be logged.
Actual behaviour: the request is not logged.

1. This does not happen if an access log valve is also configured on the Host or Engine. The default server.xml of Tomcat 7 does have such a valve in the default Host.
2. Restarting the ROOT webapp (e.g. touching its web.xml) is not enough to trigger this. (Apparently it does not cause closing of the valve).
3. It is not detected as a memory leak. (Apparently the Valve is not loaded with webapp's classloader).

So, the requests not being logged is the only effect of this issue that I am observing.
Comment 1 Mark Thomas 2010-11-24 12:30:35 UTC
Fixed in 7.0.x and will be included in 7.0.5 onwards.
Comment 2 Mark Thomas 2011-01-07 13:26:14 UTC
Fixed in 6.0.x and will be included in 6.0.30 onwards.