SLF4J offers very little in terms of functionality beyond the
abstraction of logging frameworks. I should have mentioned that it
does on so on purpose. The message interceptor functionality is not
aligned with that minimalistic philosophy. In short, there very little
chance for the interceptor code to be integrated into SLF4J.
If you wish to extend org.slf4j.Logger I suggest that you look into
the slf4j-ext module, in particular the XLogger and LoggerWrapper
classes.
http://slf4j.org/xref/org/slf4j/ext/LoggerWrapper.html
http://slf4j.org/xref/org/slf4j/ext/XLogger.html
As mentioned in my previous message, TurboFilters in logback-classic
probably already do what you want. You should know that the
log4j-over-slf4j module will allow you to migrate a project using
log4j to slf4j without changing a single line of code.
http://slf4j.org/legacy.html#log4j-over-slf4j
ogradyjd wrote:
I did entertain the idea of extending the underlying logging system, but that
ties my code to the underlying logging system. I was looking for a way to
intercept messages to any underlying logging system, and was going to use
commons logging until I saw the chatter on the net about slf4j. The point
is that I'd like to get the messages from the abstraction layer so my code
will run with whatever logging system is used, and to do that, I need a hook
into the message processing of either commons logging or slf4j - preferably
before the log message is passed to the underlying logging system.
As it stands, I'd have to write a wrapper for the "logger" class for either
slf4j or commons logging. I'd much rather use a hook into the message
processing code, and since commons logging development is, er... stagnant, I
figured I had a better chance with slf4j. I'd much rather use slf4j
considering it also works with commons logging, which gives my current
employer a migration path. My employer would not even consider moving from
Log4j to logback right now. If I were able to use slf4j, however, and still
send the messages to log4j, then the path is much easier to sell.
What do you think?
--
Ceki Gülcü
The complete log4j manual: http://www.qos.ch/log4j/
_______________________________________________
dev mailing list
dev@slf4j.org
http://www.slf4j.org/mailman/listinfo/dev