You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Agustín <ag...@gmail.com> on 2009/03/04 17:48:04 UTC

Is it possible several web servers writing in the same log file?

Hi there! I have the following question:

Two linux machines with the same web application work together in "load
balance" configuration. Could I have the same log file for the two servers?
The first idea is mount by NFS the same directory in both machines and put
there the log files, but I'm not sure if this is reliable because we would
have two JVM trying to write in the same rolling file. Any ideas would be
apreciated. 

Regards,
Agustín T.
-- 
View this message in context: http://www.nabble.com/Is-it-possible-several-web-servers-writing-in-the-same-log-file--tp22334114p22334114.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Is it possible several web servers writing in the same log file?

Posted by Ceki Gulcu <ce...@qos.ch>.
Hello Augistin,

With logback's prudent mode, it is possible for multiple FileAppender
instances running on different JVM's to write to the same file. For
more information see the prudent mode of FileAppender:

   http://logback.qos.ch/manual/appenders.html#prudent

According to our tests, prudent mode also works on NFS mounted drives.

HTH,

Agustín wrote:
> Hi there! I have the following question:
> 
> Two linux machines with the same web application work together in "load
> balance" configuration. Could I have the same log file for the two servers?
> The first idea is mount by NFS the same directory in both machines and put
> there the log files, but I'm not sure if this is reliable because we would
> have two JVM trying to write in the same rolling file. Any ideas would be
> apreciated. 
> 
> Regards,
> Agustín T.

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Is it possible several web servers writing in the same log file?

Posted by Dmitry <dm...@gmail.com>.
I don't think it's possible to synchronize against one file without some 
effort.
But you can try this product which does particularly what you're asking 
- www.moonlit-software.com.
It aggregates and routes log streams in large production environments 
and allows you to extract any log file instantly.
Works on most linuxes too..

Regards,
Dmitry.

Agustín wrote:
> Hi there! I have the following question:
>
> Two linux machines with the same web application work together in "load
> balance" configuration. Could I have the same log file for the two servers?
> The first idea is mount by NFS the same directory in both machines and put
> there the log files, but I'm not sure if this is reliable because we would
> have two JVM trying to write in the same rolling file. Any ideas would be
> apreciated. 
>
> Regards,
> Agustín T.
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org