I have the following log4j.properties file:
# Direct log messages to a log file
log4j.appender.fileerror=org.apache.log4j.RollingFileAppender
log4j.appender.fileerror.File=C\:\\logs_eba\\loging-error.log
log4j.appender.fileerror.MaxFileSize=20MB
log4j.appender.fileerror.MaxBackupIndex=1
log4j.appender.fileerror.layout=org.apache.log4j.PatternLayout
log4j.appender.fileerror.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.appender.fileerror.threshold = WARN
# 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{ABSOLUTE} %5p %c{1}:%L - %m%n
# Root logger option
log4j.rootLogger = WARN, fileerror
But my application keeps directing logs to my Console, it even shows logs at info level even though I defined WARN threshold.
For reference, this is how I get my Logging objects:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger log = LoggerFactory.getLogger(MyClass.class.getSimpleName());
log.warn("My log message");
Can it be related to my use of slf4j?
PS. I am using Spring + Hibernate as my architecture, and their logs are also being redirected to console.