[slf4j-user] How to implement handler

Dmitry Mamonov dmitry.s.mamonov at gmail.com
Wed Feb 3 13:33:05 CET 2010


Hello Ceki Gülcü,

>How is does SQLWatch integrate with log4jdbc? Is it by intercepting
>logging requests?
Here is tool implementation overview diagam (how it works currently):
http://code.google.com/p/sqlwatch/source/browse/trunk/sqlwatch2/doc/overview/sqlwatch.png

Actually yes, SQLWatch listens log-messages passed from log4jdbc and then
notifies all custom listeners which do it's own jobs (like preparing
profiling report and so on).

> As for "handlers", SLF4J only deals with loggers. It does include a
> notion of handlers in j.u.l. terminology (appenders in log4j and
> logback).
If I understand, custom wrapper for log-library (e.g. wrapper for log4j) in
slf4j is something
like handler. But in difference to JDK (Log) Handler I can't add more than 1
handler (wrapper for logging library) to SLF4J same time.

In this case I have at least two solutions:
1. implement a Proxy Wrapper (but how to attach it to slf4j in most natural
way)
which will notify SQLWatch and pass all other log-messages to concrete
wrapper (e.g. log4j wrapper).
2. Impelment all kinds of Listeners/Appenders for all possible
log-libraries.

May be here is some other (and better!) solutions, and if not,
which one is better?

--
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-user/attachments/20100203/ffd75b46/attachment.html>


More information about the slf4j-user mailing list