tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Prastein, Rebeccah H" <>
Subject log4j FileAppenders not flushing
Date Tue, 25 Nov 2008 20:34:44 GMT
I'm hoping someone here can help me with this; I've searched all over
the web, and any references to FileAppenders not flushing in the log4j
lists get the response, "not a log4j problem, must be your application."

I have a simple 3-page Spring 2.5 Spring MVC application running under
Tomcat 5.5.  I'm using log4j 1.2.14 for web application logging.  Rather
than configure log4j from a properties file or an xml file, I'm
configuring it manually in a servlet that allows me to reconfigure it in
real time using http commands.  I create two RollingFileAppenders: one
for the rootLogger containing debugging information, and one for a
separate requestLogger that shows input to and output from the

Every time I send a query to the Spring MVC applciation, there should be
a series of log entries in the debug log, and one in the request log.
What I find is that sometimes the log entries show up right away, but
more often, one or the other log will show nothing until I have queried
3, 4, or up to 8 times - and then, all of the backlogged log entries
appear.  At first, I thought maybe my real-time configuration changes
were causing I/O blocking, because I first noticed it when I was testing
that feature.  But, even if I completely leave everything as it was on
web application startup, this happens.  I tried playing with the
settings on the RollingFileAppenders, even though by default IO
buffering is supposed to be off and immediateFlush is supposed to be
true.  I added a System.out.println() following one of my logging call
statements, to tell me what the immediateFlush value is for the logger
that was just written to, and it's "true," as expected.  But it's NOT

Is there something in Tomcat that is intercepting these log4j calls and
causing this buffering behavior?  Is there some way to configure it?

Thanks for any help,

The contents of this message, together with any attachments, are
intended only for the use of the person(s) to which they are
addressed and may contain confidential and/or privileged
information. Further, any medical information herein is
confidential and protected by law. It is unlawful for unauthorized
persons to use, review, copy, disclose, or disseminate confidential
medical information. If you are not the intended recipient,
immediately advise the sender and delete this message and any
attachments. Any distribution, or copying of this message, or any
attachment, is prohibited.

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message