title: log4net - Keep NHibernate out of my app's log files and into it's own file
body: <p>I have successfully cordoned off my own logging into its own General &amp; Error Log files.</p>
  
  <p>I have added NHibernate to the mix as i'd like to record the sql statements it generates to aid debugging - but into its own file.</p>
  
  <p>With the current config I have below, the NH output is ending up in my General Log file (CommunicationsAppender) as well as it's own file (it is duplicated). How do I keep the output out of CommunicationsAppender?</p>
  
  <pre><code>&lt;log4net&gt; 
      &lt;appender name="NHibernateAppender" type="log4net.Appender.RollingFileAppender"&gt;
          &lt;file value="c:\logs\NHibernate.log"/&gt;
          &lt;appendToFile value="true"/&gt;
          &lt;maximumFileSize value="1000KB"/&gt;
          &lt;maxSizeRollBackups value="10"/&gt;
          &lt;layout type="log4net.Layout.PatternLayout"&gt;
              &lt;conversionPattern value="%date %logger %level - %message%newline"/&gt;
          &lt;/layout&gt;
          &lt;filter type="log4net.Filter.LevelRangeFilter"&gt;
              &lt;levelMin value="DEBUG" /&gt;
              &lt;levelMax value="FATAL" /&gt;
          &lt;/filter&gt;
          &lt;filter type="log4net.Filter.LoggerMatchFilter"&gt;
              &lt;loggerToMatch value="NHibernate.SQL" /&gt;
              &lt;acceptOnMatch value="true" /&gt;
          &lt;/filter&gt;
          &lt;filter type="log4net.Filter.DenyAllFilter" /&gt;
      &lt;/appender&gt;
      &lt;appender name="CommunicationsAppender" type="log4net.Appender.RollingFileAppender"&gt;
          &lt;file value="C:\Logs\Communications Service.log"/&gt;
          &lt;appendToFile value="true"/&gt;
          &lt;maximumFileSize value="10000KB"/&gt;
          &lt;maxSizeRollBackups value="10"/&gt;
          &lt;layout type="log4net.Layout.PatternLayout"&gt;
              &lt;conversionPattern value="%date %logger - %message%newline"/&gt;
          &lt;/layout&gt;
  
          &lt;filter type="log4net.Filter.LevelRangeFilter"&gt;
              &lt;levelMin value="DEBUG" /&gt;
              &lt;levelMax value="WARN" /&gt;
          &lt;/filter&gt;
          &lt;filter type="log4net.Filter.LoggerMatchFilter"&gt;
              &lt;loggerToMatch value="CommunicationsLogger" /&gt;
              &lt;acceptOnMatch value="true" /&gt;
          &lt;/filter&gt;
          &lt;filter type="log4net.Filter.DenyAllFilter" /&gt;
      &lt;/appender&gt;
      &lt;appender name="CommunicationsErrorAppender" type="log4net.Appender.RollingFileAppender"&gt;
          &lt;file value="C:\Logs\Communications Service Errors.log"/&gt;
          &lt;appendToFile value="true"/&gt;
          &lt;maximumFileSize value="10000KB"/&gt;
          &lt;maxSizeRollBackups value="10"/&gt;
          &lt;layout type="log4net.Layout.PatternLayout"&gt;
              &lt;conversionPattern value="%date %logger - %message%newline"/&gt;
          &lt;/layout&gt;
          &lt;filter type="log4net.Filter.LevelRangeFilter"&gt;
              &lt;levelMin value="ERROR" /&gt;
              &lt;levelMax value="FATAL" /&gt;
          &lt;/filter&gt;
          &lt;filter type="log4net.Filter.LoggerMatchFilter"&gt;
              &lt;loggerToMatch value="CommunicationsLogger" /&gt;
              &lt;acceptOnMatch value="true" /&gt;
          &lt;/filter&gt;
      &lt;/appender&gt;
  
      &lt;root&gt;
          &lt;!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF --&gt;
          &lt;priority value="ALL"/&gt;
          &lt;!--&lt;appender-ref ref="LogToFile"/&gt;--&gt;
          &lt;appender-ref ref="CommunicationsAppender" /&gt;
          &lt;appender-ref ref="CommunicationsErrorAppender" /&gt;
          &lt;appender-ref ref="NHibernateAppender" /&gt;
      &lt;/root&gt;
      &lt;logger name="NHibernate.SQL"&gt;
          &lt;level value="DEBUG"/&gt;
          &lt;appender-ref ref="NHibernateAppender"/&gt;
      &lt;/logger&gt;
      &lt;logger name="NHibernate"&gt;
          &lt;level value="OFF" /&gt;
      &lt;/logger&gt;
  &lt;/log4net&gt;
  </code></pre>