You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Nils Breunese (Jira)" <ji...@apache.org> on 2021/08/26 14:32:00 UTC

[jira] [Updated] (LOG4J2-3151) Messages get logged at level OFF

     [ https://issues.apache.org/jira/browse/LOG4J2-3151?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nils Breunese updated LOG4J2-3151:
----------------------------------
    Description: 
I am using the following Log4j API to log messages at a configurable level:
{code:java}
logger.atLevel(level).log(...); {code}
This works fine, but then a user configured the log level to be {{Level.OFF}} and to his surprise messages were still logged, at level {{OFF}}. This feels like a bug to me.

I have created a small demo project that reproduces this behaviour at [https://github.com/breun/log4j-off]. This project logs these two messages:
{code:java}
INFO  - Foo
OFF   - Foo {code}
But I expected only the first of those two to get logged.

  was:
I am using the following Log4j API to log messages at a configurable level:
{code:java}
logger.atLevel(level).log(...); {code}
This works fine, but then a user configured the log level to be {{Level.OFF}} and to to his surprise messages were still logged, at level {{OFF}}. This feels like a bug to me.

I have created a small demo project that reproduces this behaviour at [https://github.com/breun/log4j-off]. This project logs these two messages:
{code:java}
INFO  - Foo
OFF   - Foo {code}
But I expected only the first of those two to get logged.


> Messages get logged at level OFF
> --------------------------------
>
>                 Key: LOG4J2-3151
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3151
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.14.1
>            Reporter: Nils Breunese
>            Priority: Major
>
> I am using the following Log4j API to log messages at a configurable level:
> {code:java}
> logger.atLevel(level).log(...); {code}
> This works fine, but then a user configured the log level to be {{Level.OFF}} and to his surprise messages were still logged, at level {{OFF}}. This feels like a bug to me.
> I have created a small demo project that reproduces this behaviour at [https://github.com/breun/log4j-off]. This project logs these two messages:
> {code:java}
> INFO  - Foo
> OFF   - Foo {code}
> But I expected only the first of those two to get logged.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)