title: Logging in different files with logback sharing packages
body: <p>I have a batch application which executes two different logic depending on the parameter passed. My application uses Spring and I want to log in different log files each of this "different processes". 
  As the classes are in different packages, I configured in logback.xml file the loggers to use its own appender </p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
   &lt;configuration&gt;
  
     &lt;!-- Referencia: http://logback.qos.ch/manual/configuration.html --&gt;
  
     &lt;!-- Propiedades de configuracion --&gt;
     &lt;property resource="batch.properties" /&gt;
  
     &lt;!-- Appenders: http://logback.qos.ch/manual/appenders.html --&gt;
  
   &lt;!-- pattern: %date [%thread] %-5level %logger - [%file:%line] - %message%n --&gt;
  
  &lt;appender name="console" class="ch.qos.logback.core.ConsoleAppender"&gt;
    &lt;encoder&gt;
      &lt;pattern&gt;%date [%thread] %-5level %logger - %message%n&lt;/pattern&gt;
    &lt;/encoder&gt;
    &lt;/appender&gt;
  
    &lt;appender name="appender1" class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
     &lt;File&gt;${log.dir}/batch-${HOSTNAME}.log&lt;/File&gt;
  
  &lt;encoder&gt;
    &lt;pattern&gt;%date [%thread] %-5level %logger - %message%n&lt;/pattern&gt;
  &lt;/encoder&gt;
  
  &lt;rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"&gt;
    &lt;minIndex&gt;1&lt;/minIndex&gt;
    &lt;maxIndex&gt;10&lt;/maxIndex&gt;
    &lt;FileNamePattern&gt;${log.dir}/batch-${HOSTNAME}.log.%i&lt;/FileNamePattern&gt;
  &lt;/rollingPolicy&gt;
  
  &lt;triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"&gt;
    &lt;MaxFileSize&gt;10MB&lt;/MaxFileSize&gt;
  &lt;/triggeringPolicy&gt;
   &lt;/appender&gt;
  
  &lt;appender name="appender2" class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
    &lt;File&gt;${log.dir}/batch-${HOSTNAME}.log&lt;/File&gt;
  
   &lt;encoder&gt;
     &lt;pattern&gt;%date [%thread] %-5level %logger - %message%n&lt;/pattern&gt;
   &lt;/encoder&gt;
  
   &lt;rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"&gt;
    &lt;minIndex&gt;1&lt;/minIndex&gt;
    &lt;maxIndex&gt;10&lt;/maxIndex&gt;
    &lt;FileNamePattern&gt;${log.dir}/batch-${HOSTNAME}.log.%i&lt;/FileNamePattern&gt;
  &lt;/rollingPolicy&gt;
  
  &lt;triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"&gt;
    &lt;MaxFileSize&gt;10MB&lt;/MaxFileSize&gt;
  &lt;/triggeringPolicy&gt;
  &lt;/appender&gt;
  
  &lt;!-- Levels  --&gt;
   &lt;logger name="my.process1" level="INFO"&gt;
      &lt;appender-ref ref="appender1"&gt;/
   &lt;/logger&gt;
   &lt;logger name="my.process2" level="INFO"&gt;
  &lt;appender-ref ref="appender2"&gt;/
    &lt;/logger&gt;
    &lt;logger name="org.apache" level="INFO"/&gt;
    &lt;logger name="org.springframework" level="WARN" /&gt;
     &lt;logger name="com.ibm" level="INFO"/&gt;
  
   &lt;!-- Root --&gt;
   &lt;root level="INFO"&gt;
      &lt;appender-ref ref="console"/&gt;
   &lt;/root&gt;
  </code></pre>
  
  <p></p>
  
  <p>But I want to log Spring information too, but "only" in the file of the process it's executing. How should I configure that?</p>
  
  <p>Thanks</p>
  
  <p>EDIT: posted my actual logback.xml. I know that with that configuration spring is not logging in any file, but I dont know how to configure it to log only in one.</p>