title: Using Log4J 1.*, how can I write two packages to two separate files?
body: <p>I have the following two packages:</p>
  
  <p>com.mycorp.project.first<br>
  com.mycorp.project.second</p>
  
  <p>I'd like to configure Log4J (SLF4J) to write the logs from one package to one file, and from the other package to a second file. I do not want them to be mixed in together. </p>
  
  <p>To be clear, this is one project/one process running.</p>
  
  <p>I've tried filtering and with loggers but they seem to be ignored by log4j. Both files are always identical.</p>
  
  <p>Edit: Thank you for the answers so far, this is what I've got and it's not working. Both output files are identical.</p>
  
  <pre><code>&lt;configuration debug="true"&gt;
  &lt;contextName&gt;dev&lt;/contextName&gt;
  
  &lt;appender name="FIRST_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
      &lt;file&gt;A:/dev/LogTesting/logs/first.log&lt;/file&gt;
      &lt;filter class="ch.qos.logback.classic.filter.ThresholdFilter"&gt;
          &lt;level&gt;INFO&lt;/level&gt;
      &lt;/filter&gt;
      &lt;rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"&gt;
          &lt;fileNamePattern&gt;A:/dev/LogTesting/logs/first.%d{yyyyMMdd}%d{_HHmmss,aux}.log.gz&lt;/fileNamePattern&gt;
      &lt;/rollingPolicy&gt;
      &lt;encoder&gt;
          &lt;pattern&gt;%d{MMM dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n&lt;/pattern&gt;
      &lt;/encoder&gt;
  &lt;/appender&gt;
  
  &lt;appender name="SECOND_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
      &lt;file&gt;A:/dev/LogTesting/logs/second.log&lt;/file&gt;
      &lt;filter class="ch.qos.logback.classic.filter.ThresholdFilter"&gt;
          &lt;level&gt;INFO&lt;/level&gt;
      &lt;/filter&gt;
      &lt;rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"&gt;
          &lt;fileNamePattern&gt;A:/dev/LogTesting/logs/second.%d{yyyyMMdd}%d{_HHmmss,aux}.log.gz&lt;/fileNamePattern&gt;
      &lt;/rollingPolicy&gt;
      &lt;encoder&gt;
          &lt;Pattern&gt;%d{MMM dd HH:mm:ss.SSS} %property{HOSTNAME} [%thread] %level %logger{36} %msg%n&lt;/Pattern&gt;
      &lt;/encoder&gt;
  &lt;/appender&gt;
  
  &lt;!-- =============================================================== --&gt;
  &lt;logger name="com.test.apples" additivity="false"&gt;
      &lt;level value="DEBUG" /&gt;
      &lt;appender-ref ref="FIRST_FILE"  /&gt;
  &lt;/logger&gt;
  
  &lt;logger name="com.test.oranges" additivity="false"&gt;
      &lt;level value="DEBUG" /&gt;
      &lt;appender-ref ref="SECOND_FILE"  /&gt;
  &lt;/logger&gt;
  &lt;!-- =============================================================== --&gt;
  
  &lt;category name="com.test.apples" additivity="false"&gt;
      &lt;priority value="DEBUG"/&gt;
      &lt;appender-ref ref="FIRST_FILE"/&gt;
  &lt;/category&gt;
  
  &lt;category name="com.test.oranges" additivity="false"&gt;
      &lt;priority value="DEBUG"/&gt;
      &lt;appender-ref ref="SECOND_FILE"/&gt;
  &lt;/category&gt;
  
  &lt;!-- =============================================================== --&gt;
  
  &lt;!-- default --&gt;
  &lt;root level="WARN"&gt;
      &lt;appender-ref ref="FIRST_FILE" /&gt;
      &lt;appender-ref ref="SECOND_FILE" /&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p></p>