title: NiFi custom processor custom log, logging in two places
body: <p>NiFi 1.2.0</p>
  
  <p>I am having a custom processor and I wish to have a dedicated log file for the same. Accordingly, I have configured the com.datalake.processors.SQLServerCDCProcessor class to use an appender named 'SQLSERVER-CDC'</p>
  
  <p>Following is the logback.xml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration scan="true" scanPeriod="30 seconds"&gt;
      &lt;contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"&gt;
          &lt;resetJUL&gt;true&lt;/resetJUL&gt;
      &lt;/contextListener&gt;
  
      &lt;appender name="APP_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
          &lt;file&gt;/var/log/nifi/nifi-app.log&lt;/file&gt;
          &lt;rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"&gt;
              &lt;!--
                                 For daily rollover, use 'app_%d.log'.
                For hourly rollover, use 'app_%d{yyyy-MM-dd_HH}.log'.
                To GZIP rolled files, replace '.log' with '.log.gz'.
                To ZIP rolled files, replace '.log' with '.log.zip'.
              --&gt;
              &lt;fileNamePattern&gt;/var/log/nifi/archive/nifi-app_%d{yyyy-MM-dd_HH}.%i.log&lt;/fileNamePattern&gt;
              &lt;timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"&gt;
                  &lt;maxFileSize&gt;100MB&lt;/maxFileSize&gt;
              &lt;/timeBasedFileNamingAndTriggeringPolicy&gt;
              &lt;!-- keep 30 log files worth of history --&gt;
              &lt;maxHistory&gt;3&lt;/maxHistory&gt;
          &lt;/rollingPolicy&gt;
          &lt;encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"&gt;
              &lt;pattern&gt;%date %level [%thread] %logger{40} %msg%n&lt;/pattern&gt;
          &lt;/encoder&gt;
       &lt;immediateFlush&gt;true&lt;/immediateFlush&gt;
      &lt;/appender&gt;
  
      &lt;appender name="USER_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
          &lt;file&gt;/var/log/nifi/nifi-user.log&lt;/file&gt;
          &lt;rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"&gt;
              &lt;!--
                                 For daily rollover, use 'user_%d.log'.
                For hourly rollover, use 'user_%d{yyyy-MM-dd_HH}.log'.
                To GZIP rolled files, replace '.log' with '.log.gz'.
                To ZIP rolled files, replace '.log' with '.log.zip'.
              --&gt;
              &lt;fileNamePattern&gt;/var/log/nifi/archive/nifi-user_%d.log&lt;/fileNamePattern&gt;
              &lt;!-- keep 30 log files worth of history --&gt;
              &lt;maxHistory&gt;3&lt;/maxHistory&gt;
          &lt;/rollingPolicy&gt;
          &lt;encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"&gt;
              &lt;pattern&gt;%date %level [%thread] %logger{40} %msg%n&lt;/pattern&gt;
          &lt;/encoder&gt;
      &lt;/appender&gt;
  
      &lt;appender name="BOOTSTRAP_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
          &lt;file&gt;/var/log/nifi/nifi-bootstrap.log&lt;/file&gt;
          &lt;rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"&gt;
              &lt;!--
                For daily rollover, use 'user_%d.log'.
                For hourly rollover, use 'user_%d{yyyy-MM-dd_HH}.log'.
                To GZIP rolled files, replace '.log' with '.log.gz'.
                To ZIP rolled files, replace '.log' with '.log.zip'.
              --&gt;
              &lt;fileNamePattern&gt;/var/log/nifi/archive/nifi-bootstrap_%d.log&lt;/fileNamePattern&gt;
              &lt;!-- keep 5 log files worth of history --&gt;
              &lt;maxHistory&gt;5&lt;/maxHistory&gt;
          &lt;/rollingPolicy&gt;
          &lt;encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"&gt;
              &lt;pattern&gt;%date %level [%thread] %logger{40} %msg%n&lt;/pattern&gt;
          &lt;/encoder&gt;
      &lt;/appender&gt;
  
      &lt;appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"&gt;
          &lt;encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"&gt;
              &lt;pattern&gt;%date %level [%thread] %logger{40} %msg%n&lt;/pattern&gt;
          &lt;/encoder&gt;
      &lt;/appender&gt;
  
          &lt;!-- Start : Added for log for custom processor --&gt;
          &lt;appender name="SQLSERVER-CDC" class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
          &lt;file&gt;/var/log/nifi/sqlserver-cdc.log&lt;/file&gt;
          &lt;rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"&gt;
              &lt;!--
                For daily rollover, use 'app_%d.log'.
                For hourly rollover, use 'app_%d{yyyy-MM-dd_HH}.log'.
                To GZIP rolled files, replace '.log' with '.log.gz'.
                To ZIP rolled files, replace '.log' with '.log.zip'.
              --&gt;
              &lt;fileNamePattern&gt;/var/log/nifi/archive/sqlserver-cdc_%d{yyyy-MM-dd_HH}.%i.log&lt;/fileNamePattern&gt;
              &lt;timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"&gt;
                  &lt;maxFileSize&gt;25MB&lt;/maxFileSize&gt;
              &lt;/timeBasedFileNamingAndTriggeringPolicy&gt;
              &lt;!-- keep 30 log files worth of history --&gt;
              &lt;maxHistory&gt;3&lt;/maxHistory&gt;
          &lt;/rollingPolicy&gt;
          &lt;encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"&gt;
              &lt;pattern&gt;%date %level [%thread] %logger{40} %msg%n&lt;/pattern&gt;
              &lt;immediateFlush&gt;true&lt;/immediateFlush&gt;
          &lt;/encoder&gt;
      &lt;/appender&gt;
          &lt;!-- End : Added for log for custom processor --&gt;
  
      &lt;!-- valid logging levels: TRACE, DEBUG, INFO, WARN, ERROR --&gt;
  
      &lt;logger name="org.apache.nifi" level="INFO"/&gt;
      &lt;logger name="org.apache.nifi.processors" level="WARN"/&gt;
      &lt;logger name="org.apache.nifi.processors.standard.LogAttribute" level="INFO"/&gt;
      &lt;logger name="org.apache.nifi.controller.repository.StandardProcessSession" level="WARN" /&gt;
  
  
      &lt;logger name="org.apache.zookeeper.ClientCnxn" level="ERROR" /&gt;
      &lt;logger name="org.apache.zookeeper.server.NIOServerCnxn" level="ERROR" /&gt;
      &lt;logger name="org.apache.zookeeper.server.NIOServerCnxnFactory" level="ERROR" /&gt;
      &lt;logger name="org.apache.zookeeper.server.quorum" level="ERROR" /&gt;
      &lt;logger name="org.apache.zookeeper.ZooKeeper" level="ERROR" /&gt;
      &lt;logger name="org.apache.zookeeper.server.PrepRequestProcessor" level="ERROR" /&gt;
      &lt;logger name="org.apache.calcite.runtime.CalciteException" level="OFF" /&gt;
      &lt;logger name="org.apache.curator.framework.recipes.leader.LeaderSelector" level="OFF" /&gt;
      &lt;logger name="org.apache.curator.ConnectionState" level="OFF" /&gt;
  
      &lt;!-- Logger for managing logging statements for nifi clusters. --&gt;
      &lt;logger name="org.apache.nifi.cluster" level="INFO"/&gt;
  
      &lt;!-- Logger for logging HTTP requests received by the web server. --&gt;
      &lt;logger name="org.apache.nifi.server.JettyServer" level="INFO"/&gt;
  
      &lt;!-- Logger for managing logging statements for jetty --&gt;
      &lt;logger name="org.eclipse.jetty" level="INFO"/&gt;
  
      &lt;!-- Suppress non-error messages due to excessive logging by class or library --&gt;
      &lt;logger name="com.sun.jersey.spi.container.servlet.WebComponent" level="ERROR"/&gt;
      &lt;logger name="com.sun.jersey.spi.spring" level="ERROR"/&gt;
      &lt;logger name="org.springframework" level="ERROR"/&gt;
  
      &lt;!-- Suppress non-error messages due to known warning about redundant path annotation (NIFI-574) --&gt;
      &lt;logger name="com.sun.jersey.spi.inject.Errors" level="ERROR"/&gt;
  
      &lt;!--
          Logger for capturing user events. We do not want to propagate these
          log events to the root logger. These messages are only sent to the
          user-log appender.
      --&gt;
      &lt;logger name="org.apache.nifi.web.security" level="INFO" additivity="false"&gt;
          &lt;appender-ref ref="USER_FILE"/&gt;
      &lt;/logger&gt;
      &lt;logger name="org.apache.nifi.web.api.config" level="INFO" additivity="false"&gt;
          &lt;appender-ref ref="USER_FILE"/&gt;
      &lt;/logger&gt;
      &lt;logger name="org.apache.nifi.authorization" level="INFO" additivity="false"&gt;
          &lt;appender-ref ref="USER_FILE"/&gt;
      &lt;/logger&gt;
      &lt;logger name="org.apache.nifi.cluster.authorization" level="INFO" additivity="false"&gt;
          &lt;appender-ref ref="USER_FILE"/&gt;
      &lt;/logger&gt;
      &lt;logger name="org.apache.nifi.web.filter.RequestLogger" level="INFO" additivity="false"&gt;
          &lt;appender-ref ref="USER_FILE"/&gt;
      &lt;/logger&gt;
  
  
      &lt;!--
          Logger for capturing Bootstrap logs and NiFi's standard error and standard out.
      --&gt;
      &lt;logger name="org.apache.nifi.bootstrap" level="INFO" additivity="false"&gt;
          &lt;appender-ref ref="BOOTSTRAP_FILE" /&gt;
      &lt;/logger&gt;
      &lt;logger name="org.apache.nifi.bootstrap.Command" level="INFO" additivity="false"&gt;
          &lt;appender-ref ref="CONSOLE" /&gt;
          &lt;appender-ref ref="BOOTSTRAP_FILE" /&gt;
      &lt;/logger&gt;
  
      &lt;!-- Everything written to NiFi's Standard Out will be logged with the logger org.apache.nifi.StdOut at INFO level --&gt;
      &lt;logger name="org.apache.nifi.StdOut" level="INFO" additivity="false"&gt;
          &lt;appender-ref ref="BOOTSTRAP_FILE" /&gt;
      &lt;/logger&gt;
  
      &lt;!-- Everything written to NiFi's Standard Error will be logged with the logger org.apache.nifi.StdErr at ERROR level --&gt;
      &lt;logger name="org.apache.nifi.StdErr" level="ERROR" additivity="false"&gt;
          &lt;appender-ref ref="BOOTSTRAP_FILE" /&gt;
      &lt;/logger&gt;
  
      &lt;!-- Start : Added for log for custom processor --&gt;
      &lt;logger name="com.datalake.processors.SQLServerCDCProcessor" level="DEBUG" &gt;
          &lt;appender-ref ref="SQLSERVER-CDC"/&gt;
      &lt;/logger&gt;
      &lt;!-- End : Added for log for custom processor --&gt;
  
      &lt;root level="INFO"&gt;
          &lt;appender-ref ref="APP_FILE"/&gt;
      &lt;/root&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>The strange fact is that the custom processor debug statements are written to both 'nifi-app.log' and the 'sqlserver-cdc.log' but I want <strong>these statements to be written only in the latter('sqlserver-cdc.log')</strong>.</p>
  
  <p>What am I missing ?</p>