Tanya Bear Tanya Bear - 2 months ago 6
Java Question

Disable logging for springframework

I have an issue with logging for Spring Framework. I have

log4j.properties
file which works fine, the only thing I wanted to do is to disable
Spring Framework
logging. Thus, I added the following line, but seems that it does not work:

log4j.logger.org.springframework=OFF


Otherwise if I set debug level for the whole project it works just fine. Where is the problem?

...
log4j.appender.my_log.append=true
log4j.appender.my_log.bufferSize=8192
log4j.appender.my_log.bufferedIO=false
...

log4j.appender.my_log.threshold=DEBUG
log4j.appender.my_log.layout=org.apache.log4j.PatternLayout
log4j.appender.my_log.layout.conversionPattern=%-5p %d{ISO8601} [%C{1}] - %m%n
log4j.logger.com.dummy.mydummybox=DEBUG, my_log
log4j.logger.org.springframework=OFF, my_log

Answer

OK, the solution was to disable logging for my class, which was extending the spring class.

i.e.

log4j.logger.com.my.dummy.class=OFF