Meaningless Drivel is fun!*
The moose likes Tomcat and the fly likes multiple apps pointing so same docbase locking the log files from rolling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "multiple apps pointing so same docbase locking the log files from rolling" Watch "multiple apps pointing so same docbase locking the log files from rolling" New topic
Author

multiple apps pointing so same docbase locking the log files from rolling

uday s
Greenhorn

Joined: Jan 31, 2006
Posts: 10
Hi All,
i have this issue with tomcat5.0 where logfiles are locked and not rolling due to multiple instances created through context path locking the same file.

here are more details:
1. the tomcat's appserver\conf\server.xml has following entry

<Context path="/sampleapp/app1" docBase="sampleapp" debug="0"
reloadable="true" />

<Context path="//sampleapp/app2" docBase="sampleapp" debug="0"
reloadable="true" />


This means that user might access app1 or app2 but would be pointed to a common application noted in docBase , here : sampleapp


2. Sample app has log4j.xml configured in to generate a log file in c:\sample_log.txt for rolling every one hour
\webapps\sampleapp\WEB-INF\classes\log4j.xml

3. the issue is the log file is not rolling out as it is locked by 3 different handles of same tomcat process id [ one for samplewebapp , app1 and app2]

4. app1 and app2 are vitually mapped to sampleapp but are contending with file as independant applications

5. when context path does not have app1 or app2 mapped to sampleapp base then the files are rolling fine [ but i cannot remove this as whole point of mapping is lost]

any ideas how to generate logfiles without contention between the apps ?
one way is to deploy duplicate apps for generating logs which is redundant?


Thanks,
UdaY
uday s
Greenhorn

Joined: Jan 31, 2006
Posts: 10
Hi All ,
Please let me know if i can add any more info that you might be looking for to answer the questions ?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Search this
http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
page for 'antiResourceLocking'.

I'm not sure if this flag will keep Tomcat from locking your log files but it's probably worth a shot.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I just noticed that you said you're using 5.0 which, after searching, appears not to have this flag.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: multiple apps pointing so same docbase locking the log files from rolling