Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

tomcat2log4j

Koller Krisztian

2007-02-23


Hi,

We run a webapplication on 2 Tomcat 5.5 instance (with file session-sharing)
in cluster.

We use log4j for logging, it logs through a JDBC-Appender to mysql.

We have copied the log4j.jar under WEB-INF/lib directory of webapp. (No
under Tomcats)

Both Tomcat uses the same properties file to initialization (with Init
servlet)

We use MDC.put("id","myid") ...etc. - context of log4j for passing extra
parameters:

log4j.appender.mylog_db.layout.ConversionPattern=INSERT INTO MYLOG(ID, USER,
LEVEL, MESSAGE, DURA, DATUM) VALUES('%X{id}', '%X{user}', '%-5p', '%m',
'%X{dura}', NOW())

At bigger loading: level of MDC the logfiles mingle each other, so same
message become another user's parameter. (Probably the one Tomcat overwrites
the MDC of the another Tomcat, but it is Thread-safe)

What can we do the problem eliminate?

Thanx,
Chris




---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.