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

Dongjin Lee dongjin at apache.org
Thu Jan 27 14:36:50 CET 2022


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.
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

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

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

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

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
keybase: https://keybase.io/dongjinleekr
linkedin: kr.linkedin.com/in/dongjinleekr
speakerdeck: speakerdeck.com/dongjin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20220127/61d53d57/attachment.html>


More information about the slf4j-user mailing list