Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 68949 invoked from network); 20 Oct 2008 15:11:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Oct 2008 15:11:05 -0000 Received: (qmail 31801 invoked by uid 500); 20 Oct 2008 15:11:04 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 31779 invoked by uid 500); 20 Oct 2008 15:11:04 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Users List" Reply-To: "Log4J Users List" Delivered-To: mailing list log4j-user@logging.apache.org Received: (qmail 31768 invoked by uid 99); 20 Oct 2008 15:11:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Oct 2008 08:11:04 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [76.96.62.96] (HELO QMTA09.westchester.pa.mail.comcast.net) (76.96.62.96) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Oct 2008 15:09:52 +0000 Received: from OMTA01.westchester.pa.mail.comcast.net ([76.96.62.11]) by QMTA09.westchester.pa.mail.comcast.net with comcast id UyC91a0070EZKEL593AWkM; Mon, 20 Oct 2008 15:10:30 +0000 Received: from [192.168.10.102] ([98.200.165.8]) by OMTA01.westchester.pa.mail.comcast.net with comcast id V3AH1a0080BBgh63M3AVNy; Mon, 20 Oct 2008 15:10:30 +0000 X-Authority-Analysis: v=1.0 c=1 a=_BuvbGb_oJoA:10 a=eVUp06wiDvIA:10 a=mV9VRH-2AAAA:8 a=0FAjm0qrdlAMd41zPSIA:9 a=WJH5chiwvl4bA1hqJRG61nzFhzUA:4 a=WuK_CZDBSqoA:10 Message-Id: <18B77742-FF82-4325-8A94-20CB1924929B@apache.org> From: Curt Arnold To: "Log4J Users List" In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Subject: Re: 2 processes on the same log file? What consequences? Date: Mon, 20 Oct 2008 10:10:14 -0500 References: X-Mailer: Apple Mail (2.929.2) X-Virus-Checked: Checked by ClamAV on 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