Disable spring debug statements in log4j.xml

EDIT:

The question marked as a duplicate of my question does not provide an answer. This answer tells me how to ensure commons-logging in log4j and how to ensure that the correct log4j.xml file is being used. As per my comment at the end of this question, I have successfully ensured that I am using log4j and that I am using the correct log4j.xml file. Remove the flag that marks this question as a duplicate.

END EDIT:

I am trying to disable all the debug log instructions that spring sends to the console.

Trying doesn't work:

  <logger name="org.springframework">
    <level value="warn"></level>
    <appender-ref ref="console" /> 
  </logger>

  <root> 
    <priority value ="debug" /> 
    <appender-ref ref="console" /> 
  </root>

      

However, just changing root for the warning works and I no longer see debugging instructions as needed. But this is not a very clean solution for me.

  <root> 
    <priority value ="warn" /> 
    <appender-ref ref="console" /> 
  </root>

      

Registrar name change below:

<logger name="log4j.category.org.springframework">

      

Here is my entire log4j.xml file. We are using log4j2 for the rest of our logging

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
     <appender name="console" class="org.apache.log4j.ConsoleAppender"> 
    <param name="Target" value="System.out"/> 
    <layout class="org.apache.log4j.PatternLayout"> 
      <param name="ConversionPattern" value="%-5p %c{1} - %m%n"/> 
    </layout> 
  </appender> 

  <logger name="org.springframework">
    <level value="warn"></level>
    <appender-ref ref="console" /> 
  </logger>

  <root> 
    <priority value ="debug" /> 
    <appender-ref ref="console" /> 
  </root>
</log4j:configuration>

      

+3


source to share





All Articles