Thanks for the insights on why to avoid writing to the same file from
multiple JVMs, Andy - and for the properties suggestions Jake.  

-----Original Message-----
From: Andy McBride [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 25, 2005 11:00 AM
To: 'Log4J Users List'
Subject: RE: Where to set exernal property referred to in log4j.properties

Hi, 

>  >Maybe making the logs relative to catalina.home is the right idea.  I
>  >suppose that my only concern though is that I'm using my primary log
> file by
>  >both my web application and another external java application code.  I
>  >mentioned this a couple days ago and someone suggested that sharing one
> log
>  >file between two applications is a bad idea and that the logs would
> become
>  >garbled.  Is that really so?  I thought that it was OK to share a log
>  >between different JVMs since the log includes thread identifiers.
>  >
>
> As I understand it, the only time you need to worry about File contention
> is between two separate JVM's.  However, you will need to make sure that
> in
> one config file you don't set the FileAppender to append=true and
> append=false in another.  So, you might want to point at different files
> per application even if there is no thread level file contention.  You can
> still log you files relative to catalina.home (or catalina.base), since
> that is a JVM system variable that Tomcat provides for you automatically
> at
> startup.
> 

The fact that your config writes your thread names to the log files is
irrelevant.  If you have a two JVMs writing to the same file there is no
synchronisation between the two on file IO operations.  

If both apps try to write to the file at the same time, the best that will
happen is that one of the log records will not get written.  More likely
both logs records will get mangled together losing both log messages.  

Regards

Andy



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to