Reputation: 123
I'm running the latest IntelliJ with a project that should have a logger. However, I get:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
I know there's plugins, and I tried the Log4jMonitor, still got the error. How can I get the logging to actually make the file in the folder it is supposed to w/ IntelliJ? What do I need to download and how do I install it?
Upvotes: 6
Views: 9730
Reputation: 2837
Your project uses slf4j for logging, but no implementation is found at runtime. You can configure logging by adding eg. log4j (and the slf4j bridge) as follows.
Add the log4j (+slf4j bridge) dependency to your pom.xml
:
<dependencies>
...
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
and add an appropriate log4j.properties
file under resources
, with contents eg.
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p %c{36} - %m%n
Upvotes: 5