[slf4j-user] How to implement handler

Dmitry Mamonov dmitry.s.mamonov at gmail.com
Wed Feb 3 10:17:55 CET 2010


Good day,

I'm working on project
SQLWatch<http://code.google.com/p/sqlwatch/wiki/SQLWatch2_en> which
is targeted for
monitoring and profiling of SQL queries in Java application.

>From JDBC driver side my project is only a listener of SQL queries.
MySQL JDBC driver supports such functionality directly,
so I impremented listener for
MySQL<http://code.google.com/p/sqlwatch/source/browse/trunk/sqlwatch2/src/com/mysql/jdbc/log/SQLWatchForMySQL.java>
and
everithing is fine in this case.

But some other <http://jtds.sourceforge.net/> JDBC drivers did not support
any kind of SQL logging,
so for this cases I'm planning to use
log4jdbc<http://code.google.com/p/log4jdbc/>proxy driver.

I have implemented demo
application<http://code.google.com/p/sqlwatch/source/browse/trunk/sqlwatch2/src/sqlwatch2/demo/SQLWatchProxyDemo.java>which
listens log4jdbc and redirects
all received queries to SQLWatch for future processing.
But I have related to slf4j problem here.

I need to implement listener (or Handler in log-terminology) which will
accept messages from "jdbc.sqltiming" logger and redirect them to
SQLWatch.

The problem is:
1. how to implement this functionality in one piece (not implementing
one handler per one logging framework) if it is possible,
2. and how to not restrict programmer of using of a concrete logging
framework wrapped which is used in project currently (I mean, I can
implement my own implementation of slf4j "handler/delegate"
but it will hide custom "handler/delegate" like slf4j-jdk14-1.5.10.jar,
so this is not good)

Please help me with advice

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


More information about the slf4j-user mailing list