lesteryu / log4jdbc

Automatically exported from code.google.com/p/log4jdbc
0 stars 0 forks source link

Enhancement: Add ability to set SpyLogDelegator #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Enhancement: Add the ability to supply a custom SpyLogDelegator (to take
more control over things actually get logged.)

See attached submission which is working fine for me needs.

See this thread:
http://groups.google.com/group/log4jdbc/browse_thread/thread/21e97eda7a48b033

Original issue reported on code.google.com by mark.m.m...@gmail.com on 14 Mar 2009 at 5:12

Attachments:

GoogleCodeExporter commented 9 years ago
I'm workin on SQLWatch project 
(http://code.google.com/p/sqlwatch/wiki/SQLWatch2_en)
and I'm planning to use log4jdbc to intercept SQL from any generic JDBC Driver.

Here is demo application which uses log4jdbc: 
http://code.google.com/p/sqlwatch/source/browse/trunk/sqlwatch2/src/sqlwatch2/de
mo/SQLWatchProxyDemo.java
It uses java standard Logger and Handler to intercep logs, it's ugly
because it will not work is custom application is using another 
logger.

My *real* problem is that I can't intercept quereis from log4jdbc directly,
I must deal with slf4j. But slf4j doesn't provide any extention point to:
1. Keep all current project logging architerture as it was before SQLWatch
2. Intercept all logs from custom logger in generic way, independently
to conrteter logger (log4j or java.util.Logger or so).

For my perposes it will be perfect if I will be able to add some
logs listener *lirectly* to log4jdbc. Like I can do with MySQL 
JDBC driver - http://code.google.com/p/sqlwatch/wiki/SQLWatch2_en (see 
configuation
section)

--
http://code.google.com/p/sqlwatch/source/browse/trunk/sqlwatch2/doc/overview/sql
watch.png
here is SQLWatch tool architecture, 
- MySQL solution is on right side, is't easy to configure and use
- log4jdbc solution is on left side, it's too many unnececery layers.

Original comment by dmitry.s...@gmail.com on 3 Feb 2010 at 1:35

GoogleCodeExporter commented 9 years ago

Original comment by arthur.b...@gmail.com on 2 Mar 2011 at 2:27

GoogleCodeExporter commented 9 years ago
I use logback and I need that each servlet use it's own LoggerContext. But 
because in
SpyLogFactory:
private static SpyLogDelegator logger;
This is not posible.
It would be better if instad the  ability to set SpyLogDelegator there will be 
ability to set SpyLogDelegatorSelector.
For example, it's done in logback:
http://logback.qos.ch/apidocs/ch/qos/logback/classic/selector/ContextSelector.ht
ml
So it would be 
possible to use different SpyLogDelegator for each thread

Original comment by MatveevA...@gmail.com on 6 Dec 2012 at 4:42

GoogleCodeExporter commented 9 years ago
Issue 58 has been merged into this issue.

Original comment by arthur.b...@gmail.com on 6 Dec 2012 at 5:46

GoogleCodeExporter commented 9 years ago
It's implemented here:
https://code.google.com/p/log4jdbc/issues/detail?id=60#c9
Look at the attached .jar

Original comment by stas...@gmail.com on 21 Jan 2013 at 6:40