[slf4j-dev] [JIRA] (SLF4J-124) Add ability to log at a dynamic level
QOS.CH (JIRA)
noreply-jira at qos.ch
Fri Jan 20 10:51:01 CET 2017
[ https://jira.qos.ch/browse/SLF4J-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18062#comment-18062 ]
Anders Kreinøe commented on SLF4J-124:
--------------------------------------
Correct each of these method would have to be implemented on each instance of the Level enum. But as I see it the alternative (adding the methods to the logger interface), will push the trouble down at the Logger implementations. This includes severel classes from slf4j, but also other backends like Log4j and Logback. Some of them may be able to handle it in a pretty way, but properly at least one of them will need to implement each of the methods with a switch case, doing something different for each level. In total this would properly give more code, and involve more people (all external backends would have to implement it).
Even though the Level enum will grow big, I still think its a better alternative doing it in a way that only requires changes in one place. Doing it in the enum would make it work on all backends, no matter if that backends supports it natively or not.
> Add ability to log at a dynamic level
> -------------------------------------
>
> Key: SLF4J-124
> URL: https://jira.qos.ch/browse/SLF4J-124
> Project: SLF4J
> Issue Type: Improvement
> Components: Core API
> Affects Versions: 1.5.x
> Environment: Operating System: All
> Platform: All
> URL: http://stackoverflow.com/questions/2621701/setting-log-level-of-message-at-runtime-in-slf4j
> Reporter: Robert Elliot
> Assignee: SLF4J developers list
> Attachments: Util.java.patch
>
>
> It is occasionally useful to have a log method that takes a level as a parameter. The necessary methods can be added to the Util class without any compatibility issues as far as I can see - see attached patch.
--
This message was sent by Atlassian JIRA
(v6.4.12#64027)
More information about the slf4j-dev
mailing list