I ended up modifying a local copy and rebuilding the jdbc-4 jar. Here
is the svn diff:
C:\Users\sleblanc\code\log4jdbc-read-only\src-jdbc4\net\sf
\log4jdbc>svn diff
Index: Slf4jSpyLogDelegator.java
===================================================================
--- Slf4jSpyLogDelegator.java (revision 96)
+++ Slf4jSpyLogDelegator.java (working copy)
@@ -18,6 +18,7 @@
import java.io.IOException;
import java.io.LineNumberReader;
import java.io.StringReader;
+import java.util.List;
import java.util.StringTokenizer;
import org.slf4j.LoggerFactory;
@@ -418,6 +419,20 @@
return out.toString();
}
+ private static boolean somethingInListStartsWith(List<String>
prefixList, String className) {
+ boolean found = false;
+ if (prefixList != null ) {
+ for (String prefix: prefixList) {
+ if (className.startsWith(prefix)){
+ found = true;
+ break;
+ }
+ }
+ }
+
+ return found;
+ }
+
/**
* Get debugging info - the module and line number that called the
logger
* version that prints the stack trace information from the point
just before
@@ -482,8 +497,8 @@
{
firstLog4jdbcCall = i;
}
- else if (DriverSpy.TraceFromApplication &&
- className.startsWith(DriverSpy.DebugStackPrefix))
+ else if (DriverSpy.TraceFromApplication &&
somethingInListStartsWith(DriverSpy.DebugStackPrefix, className))
+ //className.startsWith(DriverSpy.DebugStackPrefix))
{
lastApplicationCall = i;
break;
Index: DriverSpy.java
===================================================================
--- DriverSpy.java (revision 96)
+++ DriverSpy.java (working copy)
@@ -23,13 +23,7 @@
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.*;
/**
* A JDBC driver which is a facade that delegates to one or more real
underlying
@@ -109,7 +103,7 @@
* Optional package prefix to use for finding application
generating point of
* SQL.
*/
- static String DebugStackPrefix;
+ static List<String> DebugStackPrefix;
/**
* Flag to indicate debug trace info should be from the calling
application
@@ -318,6 +312,34 @@
return propValue;
}
+ private static List<String> getStringArrayOption(Properties props,
String propName)
+ {
+ String propValue = props.getProperty(propName);
+ List <String>returnValue = new ArrayList<String>();
+ if (propValue == null || propValue.length()==0)
+ {
+ log.debug("x " + propName + " is not defined");
+ returnValue = null; // force to null, even if empty String
+ }
+ else
+ {
+ log.debug(" " + propName + " = " + propValue);
+ String [] tmpList = propValue.split(",");
+ if (tmpList != null) {
+ for (int i=0; i<tmpList.length; i++ ) {
+ returnValue.add(tmpList[i].trim());
+ }
+ }
+ else {
+ returnValue.add(propName.trim());
+ }
+
+ }
+
+
+ return returnValue;
+ }
+
/**
* Get a boolean option from a property and
* log a debug message about this.
@@ -396,7 +418,7 @@
}
// look for additional driver specified in properties
- DebugStackPrefix = getStringOption(props,
"log4jdbc.debug.stack.prefix");
+ DebugStackPrefix = getStringArrayOption(props,
"log4jdbc.debug.stack.prefix");
TraceFromApplication = DebugStackPrefix != null;
Long thresh = getLongOption(props,
"log4jdbc.sqltiming.warn.threshold");