We are using Log4j for logging in our web application. Our applications are deployed in Websphere cluster environment.
For example:
There is one Host having two different JVMs where web applications are deployed.
Host-1
JVM -1 [App-1, App-2]
JVM -2 [App-1, App-2]
Log4j configuration for App-1 is:
<log4j:configuration debug="true">
<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="FileOut" />
</appender>
<appender name="FileOut" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="/home/applogs/app-1.log" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<param name="Append" value="true" />
<param name="MaxFileSize" value="10MB" />
<param name="MaxBackupIndex" value="5" />
<param name="Threshold" value="ALL" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d %-5p - %m%n" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="ASYNC" />
</root>
</log4j:configuration>
But here the problem is different JVM logs are being written in same file /home/applogs/app-1.log.
Is there any way to configure seperate log files for clustering environment? So that my Log4j configuration should not be updated in case we deploy application in 1 JVM or 2 JVM or 3 JVM or So on?