logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cakalic, James" <James.Caka...@maritz.com>
Subject RE: AW: Log4j and Threadsafeness
Date Wed, 16 Apr 2003 17:02:27 GMT
In my experience (Java and otherwise), multiple processes writing to a common file can only
be handled with OS-level file-locking primitives. This is the only way to guarantee that all
writes to the file are atomic. Otherwise it is possible that processes can collide writing
to the file producing the sort of output behavior that you have observed. 

Java, as of 1.3, does not provide any file locking capabilities. The only way to address to
permit mutlple processes then to write to a common file is to introduce some form of collector
that becomes the single file writer. This is what the JMS and socket-based approaches do --
all logging events are sent to a centralized collector which can then handle the events, including
writing them to a file. This definitely introduces more potential points of failure in your
logging infrastructure.

Another possible solution would be to configure each server in the cluster to write to its
own file and then sweep the files into a central repository. You could merge them if needed
by timestamp -- assuming that this time-based view of activity across multiple servers was
important to you. But if each node of the cluster is running an independent instance of the
application then I'm not sure what benefit this might have.

Best regards,
Jim Cakalic

> -----Original Message-----
> From: Ramadoss Chinnakuzhandai
> [mailto:ramadoss.chinnakuzhandai@wipro.com]
> Sent: Wednesday, April 16, 2003 10:29 AM
> To: Log4J Users List
> Subject: RE: AW: Log4j and Threadsafeness
> 
> 
> 
> Yes Ceki,
>               Right now I'm doing the same...all subsystem 
> under clustered env are posting log message to the common 
> queue then there would be a daemon process running to listen 
> message from JMS Queue and call appenders attached in 
> it....there is a single file which is common for all 
> subsystem and is working fine....
> 
> Ram
> 
> -----Original Message-----
> From: Heupel, Sebastian [mailto:Sebastian.Heupel@sdm.de] 
> Sent: Wednesday, April 16, 2003 5:48 PM
> To: 'Log4J Users List'
> Subject: AW: AW: Log4j and Threadsafeness
> 
> 
> Hello Ceki,
> 
> Yes I think so, because of the fact that my application is 
> running in an clustered environment.
> 
> I think most of Web Applications do this, so there might be a 
> common "log4j pattern" how to deal with that ?
> 
> Sebastian
> 
> -----Ursprüngliche Nachricht-----
> Von: Ceki Gülcü [mailto:ceki@qos.ch] 
> Gesendet: Mittwoch, 16. April 2003 14:13
> An: Log4J Users List; 'Log4J Users List'
> Betreff: Re: AW: Log4j and Threadsafeness
> 
> 
> At 02:09 PM 4/16/2003 +0200, Heupel, Sebastian wrote:
> >I think that log4j is thread-safe, but I guess there are 
> some problems 
> >because of the fact that my application is running in a clustered 
> >environment ? Perhaps there is an idea how to deal with this?
> >
> >Thanks,
> >Sebastian
> 
> Hello Sebastian,
> 
> If I understand correctly, you have multiple processes (JVMs) 
> writing to 
> the same "physical" file. Is that correct?
> 
> 
> --
> Ceki  For log4j documentation consider "The complete log4j manual"
>        http://www.qos.ch/shop/products/clm_t.jsp 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> 
> 
> **************************Disclaimer**************************
> **********
> 
> Information contained in this E-MAIL being proprietary to 
> Wipro Limited is 
> 'privileged' and 'confidential' and intended for use only by 
> the individual
>  or entity to which it is addressed. You are notified that 
> any use, copying 
> or dissemination of the information contained in the E-MAIL 
> in any manner 
> whatsoever is strictly prohibited.
> 
> **************************************************************
> *************
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> 


Confidentiality Warning:  This e-mail contains information intended only for the use of the
individual or entity named above.  If the reader of this e-mail is not the intended recipient
or the employee or agent responsible for delivering it to the intended recipient, any dissemination,
publication or copying of this e-mail is strictly prohibited. The sender does not accept any
responsibility for any loss, disruption or damage to your data or computer system that may
occur while using data contained in, or transmitted with, this e-mail.   If you have received
this e-mail in error, please immediately notify us by return e-mail.  Thank you.


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


Mime
View raw message