Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn off logging from slf4j

Tags:

It's a third party application generating huge amounts of logentries on our appserver. Like this:

[03.03.10 15:21:57:250 CET] 00000180 FtpProtocolHa I org.slf4j.impl.JCLLoggerAdapter info Close connection : 10.227.10.10 - admin [03.03.10 15:27:35:209 CET] 00000181 MinaFtpProtoc I org.slf4j.impl.JCLLoggerAdapter info [/10.227.10.10] CLOSED ++++ 

How do I turn this output from slf4j off? I've looked in the .war-file to find some configuration for slf4j but nothing. Their website didn't help either

like image 536
Tommy Avatar asked Mar 03 '10 14:03

Tommy


People also ask

How do I turn off Info logs in SLF4J?

To disable this behavior, you must add a logback configuration file called logback. xml in your java classpath root. You can download this minimal logback. xml file and add it in the src/main/resources directory for a maven project or beside fr directory for a simple java project.

Does SLF4J use Commons Logging?

SLF4J based implementation of commons-logging wrapper APIs.

How do you change the log level in SLF4J?

When using log4j, the Logger. log(Priority p, Object message) method is available and can be used to log a message at a log level determined at runtime. We're using this fact and this tip to redirect stderr to a logger at a specific log level. slf4j doesn't have a generic log() method that I can find.

Can SLF4J work without log4j?

Conclusion. So essentially, SLF4J does not replace Log4j, Both work together. SLF4j removes the tight coupling between the application and logging frameworks. It makes it easy to replace with any other logging framework in the future with a more capable library.


1 Answers

slf4j is just a funnel to the actual log backend (here overriding jakarta commons logging), which is the one you must configure to get rid of a certain kind of messages. For logback this is the appropriate configuration snippet:

    <!--  No Tomcat debug logs -->     <configuration>     ...         <logger name="org.apache.catalina.core" level="OFF" />     ...     </configuration> 

For log4j it is very similar.

like image 163
Thorbjørn Ravn Andersen Avatar answered Sep 22 '22 03:09

Thorbjørn Ravn Andersen