title: Why is the root logger collecting all log types regardless the configuration?
body: <p>I am having problem that even though I specify the level to ERROR in the root tag, the specified appender logs all levels (debug, info, warn) to the file regardless the settings. I am not a Log4j expert so any help is appreciated.</p>
  <p>I have checked the classpath for log4j.properties (there is none) except the log4j.xml.</p>
  <p>Here is the log4j.xml file:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
  &lt;!DOCTYPE log4j:configuration SYSTEM &quot;log4j.dtd&quot;&gt;
  &lt;log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'&gt;
  
  
      &lt;!-- ============================== --&gt;
      &lt;!-- Append messages to the console --&gt;
      &lt;!-- ============================== --&gt;
  
  
      &lt;appender name=&quot;console&quot; class=&quot;org.apache.log4j.ConsoleAppender&quot;&gt;
          &lt;param name=&quot;Target&quot; value=&quot;System.out&quot; /&gt;
  
          &lt;layout class=&quot;org.apache.log4j.PatternLayout&quot;&gt;
              &lt;!-- The default pattern: Date Priority [Category] Message\n --&gt;
              &lt;param name=&quot;ConversionPattern&quot; value=&quot;[AC - %5p] [%d{ISO8601}] [%t] [%c{1} - %L] %m%n&quot; /&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;appender name=&quot;logfile&quot; class=&quot;org.apache.log4j.RollingFileAppender&quot;&gt;
          &lt;param name=&quot;File&quot; value=&quot;./logs/server.log&quot; /&gt;
          &lt;param name=&quot;MaxFileSize&quot; value=&quot;1000KB&quot; /&gt;
          &lt;param name=&quot;MaxBackupIndex&quot; value=&quot;2&quot; /&gt;
          &lt;layout class=&quot;org.apache.log4j.PatternLayout&quot;&gt;
              &lt;param name=&quot;ConversionPattern&quot; value=&quot;[AC - %-5p] {%d{dd.MM.yyyy - HH.mm.ss}} %m%n&quot; /&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;appender name=&quot;payloadAppender&quot; class=&quot;org.apache.log4j.RollingFileAppender&quot;&gt;
          &lt;param name=&quot;File&quot; value=&quot;./logs/payload.log&quot; /&gt;
          &lt;param name=&quot;MaxFileSize&quot; value=&quot;1000KB&quot; /&gt;
          &lt;param name=&quot;MaxBackupIndex&quot; value=&quot;10&quot; /&gt;
          &lt;layout class=&quot;org.apache.log4j.PatternLayout&quot;&gt;
              &lt;param name=&quot;ConversionPattern&quot; value=&quot;[AC - %-5p] {%d{dd.MM.yyyy - HH.mm.ss}} %m%n&quot; /&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;appender name=&quot;errorLog&quot; class=&quot;org.apache.log4j.RollingFileAppender&quot;&gt;
          &lt;param name=&quot;File&quot; value=&quot;./logs/error.log&quot; /&gt;
          &lt;param name=&quot;MaxFileSize&quot; value=&quot;1000KB&quot; /&gt;
          &lt;param name=&quot;MaxBackupIndex&quot; value=&quot;10&quot; /&gt;
          &lt;layout class=&quot;org.apache.log4j.PatternLayout&quot;&gt;
              &lt;param name=&quot;ConversionPattern&quot; value=&quot;[AC - %-5p] {%d{dd.MM.yyyy - HH.mm.ss}} %m%n&quot; /&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;appender name=&quot;traceLog&quot;
          class=&quot;org.apache.log4j.RollingFileAppender&quot;&gt;
          &lt;param name=&quot;File&quot; value=&quot;./logs/trace.log&quot; /&gt;
          &lt;param name=&quot;MaxFileSize&quot; value=&quot;1000KB&quot; /&gt;
          &lt;param name=&quot;MaxBackupIndex&quot; value=&quot;20&quot; /&gt;
  
          &lt;layout class=&quot;org.apache.log4j.PatternLayout&quot;&gt;
              &lt;param name=&quot;ConversionPattern&quot;
                  value=&quot;[AccessControl - %-5p] {%t: %d{dd.MM.yyyy - HH.mm.ss,SSS}} %m%n&quot; /&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;appender name=&quot;traceSocketAppender&quot; class=&quot;org.apache.log4j.net.SocketAppender&quot;&gt;
          &lt;param name=&quot;remoteHost&quot; value=&quot;localhost&quot; /&gt;
          &lt;param name=&quot;port&quot; value=&quot;4445&quot; /&gt;
          &lt;param name=&quot;locationInfo&quot; value=&quot;true&quot; /&gt;
      &lt;/appender&gt;
  
      &lt;logger name=&quot;TraceLogger&quot;&gt;
          &lt;level value=&quot;trace&quot; /&gt; &lt;!-- Set level to trace to activate tracing --&gt;
          &lt;appender-ref ref=&quot;traceLog&quot; /&gt;     
      &lt;/logger&gt;
  
      &lt;logger name=&quot;org.springframework.ws.server.endpoint.interceptor&quot;&gt;
          &lt;level value=&quot;DEBUG&quot; /&gt;
          &lt;appender-ref ref=&quot;payloadAppender&quot; /&gt;
      &lt;/logger&gt;
  
      &lt;root&gt;
          &lt;level value=&quot;error&quot; /&gt;
          &lt;appender-ref ref=&quot;errorLog&quot; /&gt;
      &lt;/root&gt;
  
  &lt;/log4j:configuration&gt;
  </code></pre>
  <p>If I replace the root with another logger, then nothing gets logged at all to the specified appender.</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;logger name=&quot;com.mydomain.logic&quot;&gt;
      &lt;level value=&quot;error&quot; /&gt;
      &lt;appender-ref ref=&quot;errorLog&quot; /&gt;
  &lt;/logger&gt;
  </code></pre>