On Oct 20, 2008, at 8:08 AM, Briganti Raffaele wrote:
Hi everyone.
We've a server with two separate processes running on it and writing
their = log on the same file. More precisely, these two processes
are two separate = WebSphere Application Servers configured to write
on the same log file: all= the other resources they work on are
separate from each other. Sometimes t= he two servers begin to
respond slowly to the requests, so we're forced to = restart the
processes to return to a normal situation.
Our idea is that having two processes writing on the same log file
is a bad= idea. Is that so?
We've also noted that the RollingFileAppender mechanism doesn't
often work:= even when the log file exceeds its maximum size and
the backup file is cre= ated, one of the two processes keeps writing
its log on the older file, not= in the newer one. This could be a
clue of a malfunctioning when two proces= ses write on the same log
file.
Any suggestion?
Hope you can help us.
Best regards.
java.io provides no mechanism to detect or reliably write to the same
file from difference processes. Both those scenarios that you have
described are well known. Users of log4j have been strongly
encouraged to avoid those scenarios.
There is a FAQ (http://logging.apache.org/log4j/1.2/faq.html#3.3) that
indirectly addresses this issue, it assumes that you know it is a
problem and tells you one suggested mechanism to address the issue
(using SocketAppenders to talk to a common SocketReceiver that then
writes to a file).
It may be possible with java.nio that an appender that could be
written to safely concurrently write to a common file. I've hoped to
explore that, but haven't gotten to it.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]