[slf4j-user] Extend slf4j Tracing Levels
ceki
ceki at qos.ch
Fri May 11 13:35:04 CEST 2012
On 11.05.2012 12:47, Robert Elliot wrote:
> Short answer: no.
>
> Longer answer:
>
> The point of SLF4J is it's a common facade or interface, you then
> choose an implementation (logback, slf4j-log4j, slf4j-jdk14 etc.).
> Obviously the existing implementations only know about & support the
> levels defined on the existing interface.
Yep, as indicates (or fails to indicate) SLF4J is just an abstraction
layer for logging frameworks.
> Obviously you could write your own interface that extends the slf4j
> Logger interface and adds those methods, but what would you do with
> the calls to them? To get support for new levels you would need to
> write your own implementation which implements your new interface with
> its new methods. You'd then have a coupling between your custom
> implementation and your custom extension of the SLF4J interface, and
> in all probability a tight coupling from your custom implementation to
> an existing logging subsystem that supports defining new levels.
The above could be seen as a critique of abstraction layers or at
least it highlights the difficulty of getting abstractions layers
right.
> I believe Markers are intended to support some of the use cases that
> might otherwise be achieved by custom log levels.
Correct. Markers give you a another dimension for filtering
events. Instead of the infoPlus level, you would use the PLUS
marker. SLF4J support the following syntax:
Marker PLUS = MarkerFactory.getMarker("PLUS");
logger.info(PLUS, "some message");
HTH,
--
Ceki
http://twitter.com/#!/ceki
> ----- Original Message -----
>> From: "William Shatner"<shatner.william at gmail.com>
>> To: slf4j-user at qos.ch
>> Sent: Friday, 11 May, 2012 11:27:33 AM
>> Subject: [slf4j-user] Extend slf4j Tracing Levels
>> Hi,
>>
>> Is it possible to extend slf4j tracing levels to have more fine
>> grained levels beyond the standard error,info etc.
>>
>> e.g
>>
>> logger.info
>> logger.infoPlus
>> ...
>> logger.error
>> logger.error1
>> logger.error2
>>
>> ..
>>
>>
>> Thanks,
>> Will
More information about the slf4j-user
mailing list