title: Separating Log4j logs in Websphere Clustring Environment
body: <p>We are using Log4j for logging in our web application. Our applications are deployed in Websphere cluster environment.</p>
  
  <p>For example:</p>
  
  <p>There is one Host having two different JVMs where web applications are deployed. </p>
  
  <pre><code>Host-1      
    JVM -1 [App-1, App-2]
    JVM -2 [App-1, App-2]
  </code></pre>
  
  <p>Log4j configuration for <strong>App-1</strong> is:</p>
  
  <p>
  </p>
  
  <pre><code>&lt;log4j:configuration debug="true"&gt;
      &lt;appender name="ASYNC" class="org.apache.log4j.AsyncAppender"&gt;
          &lt;appender-ref ref="FileOut" /&gt;
      &lt;/appender&gt;
      &lt;appender name="FileOut" class="org.apache.log4j.RollingFileAppender"&gt;
          &lt;param name="File" value="/home/applogs/app-1.log" /&gt;
          &lt;param name="DatePattern" value="'.'yyyy-MM-dd" /&gt;
          &lt;param name="Append" value="true" /&gt;
          &lt;param name="MaxFileSize" value="10MB" /&gt;
          &lt;param name="MaxBackupIndex" value="5" /&gt;
          &lt;param name="Threshold" value="ALL" /&gt;
          &lt;layout class="org.apache.log4j.PatternLayout"&gt;
              &lt;param name="ConversionPattern"
                  value="%d %-5p - %m%n" /&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;   
      &lt;root&gt;
          &lt;level value="INFO" /&gt;
          &lt;appender-ref ref="ASYNC" /&gt;
      &lt;/root&gt;    
  &lt;/log4j:configuration&gt;
  </code></pre>
  
  <p>But here the problem is different JVM logs are being written in same file <strong>/home/applogs/app-1.log</strong>.</p>
  
  <p>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? </p>