[slf4j-user] Question: supporting ALL, OFF level

Ceki Gülcü ceki at qos.ch
Thu Jan 27 15:40:36 CET 2022


Hello Dongjin,

Thank you very much for your very well researched message.

While the SLF4J API allows for logging at levels TRACE, DEBUG, INFO,
WARN and ERROR, the API does *not* allow the user to set the level of a
logger.

I would say that given that it makes no sense to log at levels OFF or
ON, it follows that there is no need to introduce these levels in SLF4J.

I would like to take you up for your offer for help, Do you have other
ideas for contribution?

Best

-- 
Ceki Gülcü

Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch



On 1/27/2022 2:36 PM, Dongjin Lee wrote:
> Hi, slf4j community,
> 
> I have a question on slf4j-api's Level definition.
> 
> As far as I know, the slf4j community is planning to support the dynamic
> logging level change feature with https://jira.qos.ch/browse/SLF4J-124
> <https://jira.qos.ch/browse/SLF4J-124>. However, since slf4j-api only
> defines five levels, omitting `ALL` and `OFF` (below), we can't call a
> method like `logger.setLevel(Level.OFF)` - which is available in other
> logging frameworks.
> 
> https://github.com/qos-ch/slf4j/blob/master/slf4j-api/src/main/java/org/slf4j/event/EventConstants.java
> <https://github.com/qos-ch/slf4j/blob/master/slf4j-api/src/main/java/org/slf4j/event/EventConstants.java>
> 
> For example, logback supports seven levels (i.e., five common ones +
> ALL, OFF):
> 
> https://github.com/qos-ch/logback/blob/master/logback-classic/src/main/java/ch/qos/logback/classic/Level.java
> <https://github.com/qos-ch/logback/blob/master/logback-classic/src/main/java/ch/qos/logback/classic/Level.java>
> 
> Log4j supports 8 levels (i.e., five common ones + FATAL, ALL, OFF):
> 
> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/Level.html
> <https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/Level.html>
> 
> Java's official logging level definition is a little bit different, but
> they also support ALL, OFF:
> 
> https://docs.oracle.com/javase/7/docs/api/java/util/logging/Level.html
> <https://docs.oracle.com/javase/7/docs/api/java/util/logging/Level.html>
> 
> So, in my humble opinion, to make the dynamic logging level change
> feature more complete, slf4j-api is much better to support ALL and OFF
> levels. What do you think?
> 
> If you agree and open an issue, I am willing to contribute.
> 
> Best,
> Dongjin
> 
> --
> 
> Dongjin Lee
> 
> A hitchhiker in the mathematical world.
> 
> github: github.com/dongjinleekr <http://github.com/dongjinleekr>
> keybase: https://keybase.io/dongjinleekr <https://keybase.io/dongjinleekr>
> linkedin: kr.linkedin.com/in/dongjinleekr
> <http://kr.linkedin.com/in/dongjinleekr>
> speakerdeck: speakerdeck.com/dongjin <http://speakerdeck.com/dongjin>
> //
> 
> _______________________________________________
> slf4j-user mailing list
> slf4j-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-user


More information about the slf4j-user mailing list