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
java spring logging


source to share


No one has answered this question yet

See similar questions:

18
How to disable Spring logging of DEBUG messages?

or similar:

36
Log4j: Why does root log collect all types of logs regardless of configuration?
15
Log4j - priority value and definition of parameter name concept
4
Log4j.properties configuration
1
Solr log output to jboss
0
log4j: WARN No applications found for the logger (org.springframework.web.filter.CharacterEncodingFilter). with log4j2
0
"WARN. There are no additional journal attachments." Even the registrar logs the content
0
Is there a way to define the default layout?
0
Why am I getting this error when I try to use log4j?
0
Download file properties
0
How to add and fix print stream in log file using log4j via properties file



All Articles
Loading...
X
Show
Funny
Dev
Pics