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 "Pavan Sara (CONS), IT" <sa...@pirelli.com> on 2006/06/28 15:27:53 UTC

Same configuration file for application running in different JVMs

Hi all,
I'm using Log4j (log4j-1.2.9.jar) for two applications (two JVMs)
which use the same configuration file and write onto the same 
log files.
Traces seem correct, but the RollingFileAppender doesn't work. 
There's no backup file but the log is reset when max size is reached.

I've recreated the "same" error using only one application, but
with two appenders writing onto the same file (for example with
a layout different).

In particular the problems seem to be:
1) the "renameTo" method fails;
2) the condition when applying rollOver is not updated.

I extended the RollingFileAppender with a class which:
- overloads rollOver() method (replacing the "renameTo" call) 
- overloads subAppend() method (performing a refresh of file features 
  before doing the check of its size).

The situation is certainly improved, but there are still some bugs
because sometimes some files are smaller and some traces miss.

Any suggestions?
What am I doing wrong?
I've also looked at log4j-1.2.13.jar, but its behaviour seem the same.

Thanks,
S.

===================================
Sara Pavan
Software Developer
ONE-ANS

email: sara.pavan.oa@pirelli.com
=================================== 




========================================================
CONFIDENTIALITY NOTICE

This message and its attachments (if any) may contain confidential,
proprietary or legally privileged information and it is intended only for
the use of the addressee named above. No confidentiality or privilege
is waived or lost by any mistransmission.

If you are not the intended recipient of this message you are hereby
notified that you must not use, disseminate, copy it in any form or take
any action in reliance on it. If you have received this message in error,
please, delete it (and any copies of it) and kindly inform the sender, of this
e-mail, by replying or go to www.pirelli.com on "contact us".
========================================================

Re: Same configuration file for application running in different JVMs

Posted by James Stauffer <st...@gmail.com>.
You shouldn't have two JVM's writing to the same file.  If you want
logs from 2 JVMs to go to the same file you can have them send out the
logs on a SocketAppender and have a ServerSocket(name?) receive them
and write them to the file.

On 6/28/06, Pavan Sara (CONS), IT <sa...@pirelli.com> wrote:
> Hi all,
> I'm using Log4j (log4j-1.2.9.jar) for two applications (two JVMs)
> which use the same configuration file and write onto the same
> log files.
> Traces seem correct, but the RollingFileAppender doesn't work.
> There's no backup file but the log is reset when max size is reached.
>
> I've recreated the "same" error using only one application, but
> with two appenders writing onto the same file (for example with
> a layout different).
>
> In particular the problems seem to be:
> 1) the "renameTo" method fails;
> 2) the condition when applying rollOver is not updated.
>
> I extended the RollingFileAppender with a class which:
> - overloads rollOver() method (replacing the "renameTo" call)
> - overloads subAppend() method (performing a refresh of file features
>   before doing the check of its size).
>
> The situation is certainly improved, but there are still some bugs
> because sometimes some files are smaller and some traces miss.
>
> Any suggestions?
> What am I doing wrong?
> I've also looked at log4j-1.2.13.jar, but its behaviour seem the same.
>
> Thanks,
> S.
>
> ===================================
> Sara Pavan
> Software Developer
> ONE-ANS
>
> email: sara.pavan.oa@pirelli.com
> ===================================
>
>
>
>
> ========================================================
> CONFIDENTIALITY NOTICE
>
> This message and its attachments (if any) may contain confidential,
> proprietary or legally privileged information and it is intended only for
> the use of the addressee named above. No confidentiality or privilege
> is waived or lost by any mistransmission.
>
> If you are not the intended recipient of this message you are hereby
> notified that you must not use, disseminate, copy it in any form or take
> any action in reliance on it. If you have received this message in error,
> please, delete it (and any copies of it) and kindly inform the sender, of this
> e-mail, by replying or go to www.pirelli.com on "contact us".
> ========================================================
>
>


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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