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 Briganti Raffaele <Ra...@chebanca.it> on 2008/10/20 15:08:53 UTC

2 processes on the same log file? What consequences?

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.


________________________________
Questa comunicazione ha carattere riservato ed e coperta da segreto bancario; le informazioni in essa contenute non possono essere in nessun modo rivelate o diffuse. Qualora non siate i destinatari della comunicazione Vi preghiamo di avvertire il mittente con sollecitudine e di inviare per posta la comunicazione che avete ricevuto. Grazie.
--------------------------------------------------------------------------------------------------------------
Cette communication est a caractere reserve et est couverte par le secret bancaire; les informations contenues ne peuvent etre communiquees ou diffusees. Dans le cas ou vous ne seriez pas le destinataire de ce mail, nous vous prions d.en avertir expressement l.expediteur par retour de mail. Merci
--------------------------------------------------------------------------------------------------------------
This message is of a confidential nature and is covered by Italian banking secrecy. The information contained herein may not be disclosed to third parties or disseminated in any way. If you are not the intended recipient, please immediately notify the sender. Thank you.

Re: 2 processes on the same log file? What consequences?

Posted by Curt Arnold <ca...@apache.org>.
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: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org