I had a similar problem with log4j.
We host our webapp for various customers, an instance (host) per
customer, therefore the same code for each customer.  I tried sharing
log4j.jar in shared/lib, but found all customer loading into the same
log file - very confusing.
My solution was to put log4j.jar in WEB-INF/lib of each instance, along
with individual log4j.properties files and setting different file paths
in the properties files.  Only solution I could find.

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petre...@gmail.com] 
Sent: Tuesday, September 22, 2009 6:02 AM
To: Tomcat Users List
Subject: Re: Log4j

2009/9/22 Nishant Chandra <nishant.chan...@gmail.com>:
> I want to use Log4j and log from different web apps to one directory -
> tomcat_home/output/logs/{webapp_context}_service.log
>
> What should be the configuration in log4j.properties?
> I am currently using
> log4j.appender.xml.file=${catalina.base}/output/logs/service.log
>
> What I want is to append app_context in the file name.

IIRC, there is no way to obtain the application context path as an
environment variable.
You should configure Log4j using its APIs, using a
ServletContextListener.
Probably the best way is to load the "log4j.properties" file and
modify only the property that refers to the path of the file, then
configure Log4j.

Antonio

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



*******************************  NOTICE  *********************************
This message is intended for the use of the individual or entity to which 
it is addressed and may contain information that is privileged, 
confidential, and exempt from disclosure under applicable law.  If the 
reader of this message is not the intended recipient or the employee or 
agent responsible for delivering this message to the intended recipient, 
you are hereby notified that any dissemination, distribution, or copying 
of this communication is strictly prohibited.  If you have received this 
communication in error, please notify us immediately by reply or by 
telephone (call us collect at 512-343-9100) and immediately delete this 
message and all its attachments.


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

Reply via email to