[
https://issues.apache.org/jira/browse/LOG4J2-41?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13832166#comment-13832166
]
Gary Gregory commented on LOG4J2-41:
------------------------------------
Well, now is a good time to review since we are not at 2.0 yet.
A couple of points: While I have myself longed for an extra Level from time to
time, like a VERBOSE levl that would sit between DEBUG and INFO. I've found
that in most cases I can do with a specially named Logger instead of a new
Level.
I have seen some truly nasty Log4J 1 code that involves absurd use of custom
levels, where, in fact, using better named Loggers would have been the
'correct' solution. No matter what you write in the manual, if you make a gun,
some people are bound to shoot themselves in the proverbial foot.
But here we are on the cusp of 2.0.
There is an in between solution, may in fact. For example: We can add as many
Levels as we can think of to the Level enum as part of 2.0 and, this is the
key, do nothing else, so people can use the current API. Sure, they won't have
the nicer APIs with the level names built-in but at least the extra levels are
there.
This brings me to my second point: I do not care how big an API is, as long as
it is the right API. If we think that adding another level is needed and that
means adding 18 new methods, then so be it.
So I propose to divide this issue into steps:
# What are the levels we should provide?
# Should the levels still be represented as an enum?
# Should the extra levels be presented in the API, like Logger#isDebug() and
debug(), and so on.
## Do nothing, use the Level APIs
## Add APIs for the new levels
## Add an int based API as suggested.
> Extensible Log Level
> --------------------
>
> Key: LOG4J2-41
> URL: https://issues.apache.org/jira/browse/LOG4J2-41
> Project: Log4j 2
> Issue Type: Improvement
> Components: API
> Reporter: Ralph Goers
>
> It is desirable to have the Level be an enum. However, it is also desirable
> to let users add new log levels. These goals are in opposition to each other
> since enum classes are final. In addition, adding new levels implies adding
> new methods to the Logger interface (or some counterpart to it). This would
> be unworkable.
--
This message was sent by Atlassian JIRA
(v6.1#6144)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]