mtmx
mtmx

Reputation: 947

Console: logging messages with lower level than configured in log4.properties

This is my log4j configuration file:

# Root logger option
log4j.rootLogger=ERROR, file, stdout

# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=logging.log
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

# Direct log messages to 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} %-5p %c{1}:%L - %m%n

Logging level is set to error, but in console I have many logs with level: info or debug. Why this messages are logged into console? My configuration is invalid? Example console log: https://pastebin.com/QEHnAYVg In @Before annotation in my test i have line: PropertyConfigurator.configure("log4j.properties");, maybe there's source of problems?

Upvotes: 0

Views: 45

Answers (1)

mtmx
mtmx

Reputation: 947

Answer: missing slf4j-log4j12 dependency

Upvotes: 1

Related Questions