This needs to be an FAQ.  

Log levels are defined as enums. Unfortunately, Java enums cannot be extended.  

In addition, at the moment the API only allows you to call methods like debug, 
error, etc. Although we might add log methods that accept a level, we will 
never add methods with names of levels that don't exist. This means if you 
create your own custom levels then your users will either need a custom API or 
have to use the log method, assuming it is added. At the moment they would have 
no way to use the custom level.

FWIW, if you can justify why an additional log level should be added that would 
certainly be considered.

Ralph


On Mar 22, 2013, at 3:24 AM, Jacob Dall wrote:

> Dear "Log4j 2" developers.
> 
> From all the postings on the internet concerning custom log levels with 
> "Log4j 2" it is obvious that this shall be accomplished by using the Markers 
> feature.
> 
> Unfortunately this only solves half of the problem, because this does not 
> make it possible to set the log level on a logger to one besides the 
> predefined ones.
> 
> So if one, for instance, defines a custom level NOTICE to be located between 
> INFO and WARN, one can log an event with level NOTICE, but cannot set a 
> logger to only log NOTICE and above - one has to set the level to INFO to 
> capture NOTICE level messages, which does the trick, but is not exactly right.
> 
> I like the new features in "Log4j 2", but in this particular area I believe 
> it has missed the train. 
> 
> Would someone be so kind as to enlighten me on the reasoning behind making it 
> impossible for programmers to extend the log levels like it was possible in 
> "Log4j 1"?
> 
> 
> Kind regards
> Jacob Dall
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to