You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2021/04/28 06:43:00 UTC
[jira] [Commented] (LOG4J2-3084) How to write only one log file
when one application has many JVMs
[ https://issues.apache.org/jira/browse/LOG4J2-3084?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17334506#comment-17334506 ]
Ralph Goers commented on LOG4J2-3084:
-------------------------------------
Resist the temptation to have multiple VMs write to a single file. First off, Log4j's RollingFileAppender doesn't support file locking yet. If it did performance would take a big hit. Furthermore, my experience with trying to use file locking on Unix systems is that it just doesn't work properly with some file systems.
You would be much better off having all the servers write to a collector and have it write to the file.
> How to write only one log file when one application has many JVMs
> -----------------------------------------------------------------
>
> Key: LOG4J2-3084
> URL: https://issues.apache.org/jira/browse/LOG4J2-3084
> Project: Log4j 2
> Issue Type: Question
> Reporter: Tony
> Priority: Major
>
> I have an application which resides in a webpshere application server that has 4 JVMs.
> I can see that 4 logs files rotates at the same time. I suppose that this issue is because we have 4 JVM and they are working. Example:
> File | Date
> x_1.log | 10:10:01
> x_2.log | 10:10:01
> x_3.log | 10:10:01
> x.log | 10:10:01
> I would like to do:
> # All servers (4 JVMs) write the logs in one only file. I was investigating and i think i can use "Prevent mode" for this?
> File | Date
> x_1.log | 10:00:01
> x_2.log | 10::0501
> x_3.log | 10:10:01
> x.log | 10:15:00
> 2. Each server o JVM has its our log file. Is it possible with Log4j?
> x_server1.log
> x_server1_1.log
> x_server1_2.log
> x_server2.log
> x_server2_1.log
> x_server2_2.log
>
> Thanks.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)