logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Goers (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-1702) Logging file level affecting console level
Date Sun, 13 Nov 2016 18:55:58 GMT

    [ 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-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message