[ 
https://issues.apache.org/jira/browse/LOG4J2-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15661924#comment-15661924
 ] 

Ralph Goers commented on LOG4J2-1702:
-------------------------------------

1. You did not specify the additivity attribute, which defaults to true, so any 
events accepted by the file logger will also be passed to any of its parent 
loggers (root in this case).
2. To be consistent with its processors, Log4j 1 and Logback, the log level 
specified on the logger is ONLY checked for the initial Logger. If it passes 
there the event is passed to all parent Loggers where the level is not checked.

That said, you can configure parent Loggers with Filters and those filters will 
be used to determine if the event should be ignored.

> Logging file level affecting console level
> ------------------------------------------
>
>                 Key: LOG4J2-1702
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1702
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.7
>         Environment: MS Windows 10, IntelliJ IDEA Community Edition 2016.2.5, 
> JavaFX
>            Reporter: David Senkyr
>
> Please see this question: 
> http://stackoverflow.com/questions/40556645/log4j2-logging-file-level-affecting-console-level
> "logger.file.level" affecting "rootLogger.level"  in settings 
> (log4j2.properties).
> ----
> Copying the SO description here:
> {code}
> appender.console.type = Console
> appender.console.name = STDOUT
> appender.console.layout.type = PatternLayout
> appender.console.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] 
> %c{1}: %msg%n
> appender.file.type = File
> appender.file.name = LOGFILE
> appender.file.fileName = logs/TEMOS.log
> appender.file.layout.type=PatternLayout
> appender.file.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] 
> %c{1}: %msg%n
> loggers = file
> logger.file.name=org.company.test
> logger.file.level = info
> logger.file.append = false
> logger.file.appenderRefs = file
> logger.file.appenderRef.file.ref = LOGFILE
> rootLogger.level = all
> rootLogger.appenderRefs = stdout
> rootLogger.appenderRef.stdout.ref = STDOUT
> {code}
> The console contains only _info messages_ as well as file. After changing 
> {{logger.file.level}} to _all_, console contains _all messages_ as well as 
> file.
> Why does {{logger.file.level}} affect {{rootLogger.level}} in this 
> configuration (log4j2.properties)?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to