[slf4j-user] Localizing log levels

ceki ceki at qos.ch
Tue May 29 13:35:33 CEST 2012


On 29.05.2012 11:43, Dario Campagna wrote:
> Hi all,
>
>     Yesterday I started experimenting with the org.slf4j.cal10n package
> for generating localized logs using logback loggers. I found it very
> simple to use in order to generate localized log messages, but I did
> not find a way to localize log level names.
>
> Moreover, I noticed that when changing the default locale the log
> level names (i.e., TRACE, DEBUG, INFO, etc.) remain the same. They do
> not change to localized severity level texts like with
> java.util.logging loggers.
>
> Is there a way to localize log levels (other than rewriting parts of
> slf4j/logback)?

No. SLF4J does not support localization of level names. In fact, it does 
not define level on it own. (There is no Level class in SLF4J.) The 
underlying logging system, e.g. log4j, logback, would need perform the 
localization.

If you are using logback, that would be fairly trivial to do.

HTH,




-- 
Ceki
http://twitter.com/#!/ceki


More information about the slf4j-user mailing list