mirror of
https://github.com/encounter/log4jdbc.git
synced 2026-03-30 11:27:21 -07:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d8cbd4cdf | |||
| 21cbf688ec | |||
| 44043261af | |||
| 86364a24fa | |||
| 4900e751bb | |||
| 9da5241e39 | |||
| ddbee4d1b6 | |||
| 6bf61ef02b | |||
| 18c7e2fd19 |
+33
-18
@@ -1,38 +1,53 @@
|
||||
2008-04-11 1.1 Release
|
||||
|
||||
o upgrade to SLF4J 1.5. Note that log4jdbc should still work with
|
||||
any older (or newer) version of SLF4J too.
|
||||
|
||||
o slightly better fault tolerance for when loading/probing of
|
||||
popular JDBC drivers fails for any reason.
|
||||
|
||||
2007-11-10 1.1 beta 1 Release
|
||||
|
||||
o added HSQLDB (org.hsqldb.jdbcDriver) and H2 (org.h2.Driver)
|
||||
to list of "well known" drivers that log4jdbc looks for at startup.
|
||||
o added HSQLDB (org.hsqldb.jdbcDriver) and H2 (org.h2.Driver) to
|
||||
list of "well known" drivers that log4jdbc looks for at startup.
|
||||
|
||||
o added log4jdbc.sqltiming.warn.threshold and log4jdbc.sqltiming.error.threshold system property
|
||||
settings to greatly aid in finding slow running sql. Special thanks to Lilianne E. Blaze for the idea
|
||||
and initial implementation.
|
||||
o added log4jdbc.sqltiming.warn.threshold and
|
||||
log4jdbc.sqltiming.error.threshold system property settings to
|
||||
greatly aid in finding slow running sql. Special thanks to
|
||||
Lilianne E. Blaze for the idea and initial implementation.
|
||||
|
||||
2007-07-25 1.1 alpha 2 Release
|
||||
|
||||
o JDBC 4.0 support!
|
||||
|
||||
o fix Null pointer exception bug that could happen with setObject call on PreparedStatementSpy
|
||||
o fix Null pointer exception bug that could happen with setObject
|
||||
call on PreparedStatementSpy
|
||||
|
||||
o added MySQL (com.mysql.jdbc.Driver) and PostgreSQL (org.postgresql.Driver)
|
||||
to list of "well known" drivers that log4jdbc looks for at startup.
|
||||
o added MySQL (com.mysql.jdbc.Driver) and PostgreSQL
|
||||
(org.postgresql.Driver) to list of "well known" drivers that
|
||||
log4jdbc looks for at startup.
|
||||
|
||||
2007-05-29 1.1 alpha 1 Release
|
||||
|
||||
o Fixed problem where when sql timing log was the only log turned on, log4jdbc would not recognize that
|
||||
logging was on at all.
|
||||
o Fixed problem where when sql timing log was the only log turned
|
||||
on, log4jdbc would not recognize that logging was on at all.
|
||||
|
||||
o report sql exceptions in the sql timing log as well (when they occured during sql execution) and
|
||||
prominently show that the sql FAILED, and display how long it tried to chug on the sql
|
||||
before the exception was thrown
|
||||
o report sql exceptions in the sql timing log as well (when they
|
||||
occured during sql execution) and prominently show that the sql
|
||||
FAILED, and display how long it tried to chug on the sql before
|
||||
the exception was thrown.
|
||||
|
||||
o Switch to Simple Logging Facade for Java SLF4J instead of using log4j directly, so that any underlying
|
||||
logging system can be easily used.
|
||||
o Switch to Simple Logging Facade for Java SLF4J instead of using
|
||||
log4j directly, so that any underlying logging system can be
|
||||
easily used.
|
||||
|
||||
o option added to ant build script to generate javadoc with ydoc to include UML diagrams within the javadoc.
|
||||
o option added to ant build script to generate javadoc with ydoc
|
||||
to include UML diagrams within the javadoc.
|
||||
|
||||
o dump batched sql correctly.
|
||||
|
||||
o add simple command line program (PostLogProfilerProcessor) for processing sqltiming log files to create
|
||||
a simple profiling report from log data.
|
||||
o add simple command line program (PostLogProfilerProcessor) for
|
||||
processing sqltiming log files to create a simple profiling
|
||||
report from log data.
|
||||
|
||||
2007-04-21 Initial 1.0 Release
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
log4jdbc is open source software, released under the Apache License, Version 2.0:
|
||||
|
||||
Copyright 2007 Arthur Blake
|
||||
Copyright 2007-2008 Arthur Blake
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use log4jdbc except in compliance with the License.
|
||||
|
||||
@@ -16,3 +16,5 @@ o ALL String concatenation & dumping methods should take place ONLY if logging
|
||||
o review dumpedSql method - make auto line breaking option (& num chars used) be options
|
||||
|
||||
o need log4jdbc.debug.stack.regex so that the stack matching can take place via regex
|
||||
|
||||
o maven2 repository support
|
||||
|
||||
+9
-5
@@ -27,12 +27,13 @@
|
||||
</h1>
|
||||
|
||||
<p>
|
||||
<b>log4jdbc</b> is a JDBC driver that can log SQL and/or JDBC calls (and optionally SQL timing information)
|
||||
<b>log4jdbc</b> is a Java JDBC driver that can log SQL and/or JDBC calls (and optionally SQL timing information)
|
||||
for other JDBC drivers using the <a target="slf4j" href="http://www.slf4j.org/">Simple Logging Facade For Java</a> (SLF4J) logging system.
|
||||
</p>
|
||||
|
||||
<h2><a name="news"/>news</h2>
|
||||
<p class="left"><b>2007-11-10:</b> <a href="http://sourceforge.net/forum/forum.php?forum_id=753559">log4jdbc 1.1 beta 1 released.</a> New optional timing threshold settings for honing in on slow SQL. See <a href="CHANGES">CHANGES</a> for all the release details.</p>
|
||||
<p class="left"><b>2008-04-11:</b> <a href="http://sourceforge.net/forum/forum.php?forum_id=810350">log4jdbc 1.1 final release out!</a> See <a href="CHANGES">CHANGES</a> for all the release details.</p>
|
||||
<p class="left"><b>2007-11-10:</b> <a href="http://sourceforge.net/forum/forum.php?forum_id=753559">log4jdbc 1.1 beta 1 released.</a> New optional timing threshold settings for honing in on slow SQL.</p>
|
||||
<p class="left"><b>2007-07-25:</b> <a href="http://sourceforge.net/forum/forum.php?forum_id=719640">log4jdbc 1.1 alpha 2 released.</a> JDBC 4 support!</p>
|
||||
<p class="left"><b>2007-05-29:</b> <a href="http://sourceforge.net/forum/forum.php?forum_id=700185">log4jdbc 1.1 alpha 1 released.</a> Most notable change is that the <a target="slf4j" href="http://slf4j.org">Simple Logging Facade for Java</a> is now used instead of <b>log4j</b> directly.
|
||||
<p class="left"><b>2007-04-21:</b> <a href="http://sourceforge.net/forum/forum.php?forum_id=688372">log4jdbc 1.0 has been released!</a> Download it and give it a try!</p>
|
||||
@@ -252,7 +253,7 @@ for other JDBC drivers using the <a target="slf4j" href="http://www.slf4j.org/">
|
||||
<h2><a name="advanced"/>advanced</h2>
|
||||
<ul class="left">
|
||||
<li>A simple tool is included which you can use to post-process sql timing logs produced by log4jdbc.
|
||||
It produces produce simple profiling reports with statistics and a dump of the sql statements that ran the slowest within the log.
|
||||
It can output simple profiling reports with statistics and a dump of the sql statements that ran the slowest within the log.
|
||||
To invoke the tool, use the profsql.sh (for unix/linux) and profsql.cmd (for windows) scripts located in the scripts
|
||||
folder. These scripts take as one argument, the filename of a sql timing log (generated from the
|
||||
<code>jdbc.sqltiming</code> log category. They produce a profiling report to stdout.
|
||||
@@ -331,9 +332,10 @@ for other JDBC drivers using the <a target="slf4j" href="http://www.slf4j.org/">
|
||||
<a href="apidocs-jdbc3/net/sf/log4jdbc/package-summary.html">JDK1.4/JDBC 3 javadoc</a> |
|
||||
<a href="apidocs-jdbc4/net/sf/log4jdbc/package-summary.html">JDK1.6/JDBC 4 javadoc</a>
|
||||
<br>
|
||||
<img class="logo" src="log4jdbc-logo-gray.png">
|
||||
|
||||
<img class="logo" src="log4jdbc-logo-gray.png"><br>
|
||||
<p class="copyright">Copyright © 2007-2008 <a href="http://arthur.blake.name">Arthur Blake</a></p>
|
||||
</h1>
|
||||
|
||||
<p class="ad">
|
||||
YourKit is kindly supporting open source projects with its full-featured Java Profiler.
|
||||
YourKit, LLC is creator of innovative and intelligent tools for profiling
|
||||
@@ -341,6 +343,8 @@ Java and .NET applications. Take a look at YourKit's leading software products:
|
||||
<a href="http://www.yourkit.com/java/profiler/index.jsp">YourKit Java Profiler</a> and
|
||||
<a href="http://www.yourkit.com/.net/profiler/index.jsp">YourKit .NET Profiler</a>.
|
||||
</p>
|
||||
|
||||
<a href="http://sourceforge.net/projects/log4jdbc/"><img alt="sourceforge" title="log4jdbc sourceforge page" class="sflogo" src="sourceforge_whitebg.gif"></a>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+2
-1
@@ -27,5 +27,6 @@ code,pre {color:navy;background-color:beige;font-size:11pt;}
|
||||
pre {border:2px dashed navy;margin-left:3em;margin-right:4em;margin-top:1em;margin-bottom:1em;white-space:pre-line;}
|
||||
|
||||
.ad {font-size:0.8em;color:blue}
|
||||
|
||||
.copyright {font-size:0.8m;text-align:center}
|
||||
.copyright a {color:#ef39e9}
|
||||
.sflogo {float:right; margin-right:30px;}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+16
-2
@@ -9,6 +9,20 @@
|
||||
built with jdk 1.4.2_13 (for use with jdbc3)
|
||||
and/or jdk 1.6.0 (for use with jdbc4)
|
||||
|
||||
Copyright 2007-2008 Arthur Blake
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
-->
|
||||
|
||||
<project name="log4jdbc" default="all" basedir="..">
|
||||
@@ -34,7 +48,7 @@
|
||||
|
||||
|
||||
<!-- release version -->
|
||||
<property name="version" value="1.1beta1"/>
|
||||
<property name="version" value="1.1"/>
|
||||
|
||||
<target name="all" depends="cleancompile,compile,cleanjar,jar"/>
|
||||
|
||||
@@ -194,7 +208,7 @@
|
||||
<!-- note that the jdk source code is referenced here so that javadoc will be generated from
|
||||
interface class methods when none is specified in the implementation -->
|
||||
|
||||
<sourcepath path="/jdk1.6.0/src"/>
|
||||
<sourcepath path="/jdk1.6.0_03/src"/>
|
||||
<link href="http://java.sun.com/javase/6/docs/api/"/>
|
||||
<!--
|
||||
<link href="http://java.sun.com/j2ee/1.4/docs/api/"/>
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
rem *************************************************************************************************
|
||||
rem * *
|
||||
rem * Copyright 2007 Arthur Blake *
|
||||
rem * Copyright 2007-2008 Arthur Blake *
|
||||
rem * *
|
||||
rem * Licensed under the Apache License, Version 2.0 (the "License"); *
|
||||
rem * you may not use this file except in compliance with the License. *
|
||||
@@ -25,4 +25,4 @@ rem * profiling output report.
|
||||
rem * *
|
||||
rem *************************************************************************************************
|
||||
|
||||
java -Xmx1024m -classpath ..\build\log4jdbc-1.1beta1.jar net.sf.log4jdbc.PostLogProfilerProcessor %*
|
||||
java -Xmx1024m -classpath ..\build\log4jdbc3-1.1.jar net.sf.log4jdbc.PostLogProfilerProcessor %*
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
# *************************************************************************************************
|
||||
# * *
|
||||
# * Copyright 2007 Arthur Blake *
|
||||
# * Copyright 2007-2008 Arthur Blake *
|
||||
# * *
|
||||
# * Licensed under the Apache License, Version 2.0 (the "License"); *
|
||||
# * you may not use this file except in compliance with the License. *
|
||||
@@ -25,4 +25,4 @@
|
||||
# * *
|
||||
# *************************************************************************************************
|
||||
|
||||
java -Xmx1024m -classpath ../build/log4jdbc-1.1beta1.jar net.sf.log4jdbc.PostLogProfilerProcessor $@
|
||||
java -Xmx1024m -classpath ../build/log4jdbc3-1.1.jar net.sf.log4jdbc.PostLogProfilerProcessor $@
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/**
|
||||
*
|
||||
* Copyright 2007 Arthur Blake
|
||||
* Copyright 2007-2008 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007 Arthur Blake
|
||||
* Copyright 2007-2008 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,7 +64,7 @@ public class ConnectionSpy implements Connection, Spy
|
||||
* Create a new ConnectionSpy that wraps a given Connection.
|
||||
*
|
||||
* @param realConnection "real" Connection that this ConnectionSpy wraps.
|
||||
* @param rdbmsSpecifics the RdbmsSpecifics object for formatting logging appropriate for the Rdbms used.
|
||||
* @param rdbmsSpecifics the RdbmsSpecifics object for formatting logging appropriate for the Rdbms used.
|
||||
*/
|
||||
public ConnectionSpy(Connection realConnection, RdbmsSpecifics rdbmsSpecifics)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007 Arthur Blake
|
||||
* Copyright 2007-2008 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,11 +31,11 @@ import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
* A JDBC driver which is a facade that delegates to one or more real underlying
|
||||
* JDBC drivers. The driver will spy on any other JDBC driver that is loaded,
|
||||
* simply by prepending <code>jdbc:log4</code> to the normal jdbc driver URL
|
||||
* used by any other JDBC driver. The driver also loads several well known
|
||||
* drivers at class load time, so that this driver can be "dropped in" to any
|
||||
* java program that uses these drivers without making any code changes.
|
||||
* JDBC drivers. The driver will spy on any other JDBC driver that is loaded,
|
||||
* simply by prepending <code>jdbc:log4</code> to the normal jdbc driver URL
|
||||
* used by any other JDBC driver. The driver also loads several well known
|
||||
* drivers at class load time, so that this driver can be "dropped in" to any
|
||||
* java program that uses these drivers without making any code changes.
|
||||
* The well known driver classes that are loaded are:
|
||||
* <p/>
|
||||
* <p/>
|
||||
@@ -56,24 +56,24 @@ import java.util.TreeSet;
|
||||
* <p/>
|
||||
* <p/>
|
||||
* Additional drivers can be set via a system property: <b>log4jdbc.drivers</b>
|
||||
* This can be either a single driver class name or a list of comma separated
|
||||
* This can be either a single driver class name or a list of comma separated
|
||||
* driver class names.
|
||||
* <p/>
|
||||
* If any of the above driver classes cannot be loaded, the driver continues on
|
||||
* If any of the above driver classes cannot be loaded, the driver continues on
|
||||
* without failing.
|
||||
* <p/>
|
||||
* Note that the <code>getMajorVersion</code>, <code>getMinorVersion</code> and
|
||||
* <code>jdbcCompliant</code> method calls attempt to delegate to the last
|
||||
* <code>jdbcCompliant</code> method calls attempt to delegate to the last
|
||||
* underlying driver requested through any other call that accepts a JDBC URL.
|
||||
* <p/>
|
||||
* This can cause unexpected behavior in certain circumstances. For example,
|
||||
* if one of these 3 methods is called before any underlying driver has been
|
||||
* established, then they will return default values that might not be correct
|
||||
* This can cause unexpected behavior in certain circumstances. For example,
|
||||
* if one of these 3 methods is called before any underlying driver has been
|
||||
* established, then they will return default values that might not be correct
|
||||
* in all situations. Similarly, if this spy driver is used to spy on more than
|
||||
* one underlying driver concurrently, the values returned by these 3 method
|
||||
* one underlying driver concurrently, the values returned by these 3 method
|
||||
* calls may change depending on what the last underlying driver used was at the
|
||||
* time. This will not usually be a problem, since the driver is retrieved by
|
||||
* it's URL from the DriverManager in the first place (thus establishing an
|
||||
* time. This will not usually be a problem, since the driver is retrieved by
|
||||
* it's URL from the DriverManager in the first place (thus establishing an
|
||||
* underlying real driver), and in most applications their is only one database.
|
||||
*
|
||||
* @author Arthur Blake
|
||||
@@ -86,7 +86,7 @@ public class DriverSpy implements Driver
|
||||
private Driver lastUnderlyingDriverRequested;
|
||||
|
||||
/**
|
||||
* Maps driver class names to RdbmsSpecifics objects for each kind of
|
||||
* Maps driver class names to RdbmsSpecifics objects for each kind of
|
||||
* database.
|
||||
*/
|
||||
private static Map rdbmsSpecifics;
|
||||
@@ -94,13 +94,13 @@ public class DriverSpy implements Driver
|
||||
static final SpyLogDelegator log = SpyLogFactory.getSpyLogDelegator();
|
||||
|
||||
/**
|
||||
* Optional package prefix to use for finding application generating point of
|
||||
* Optional package prefix to use for finding application generating point of
|
||||
* SQL.
|
||||
*/
|
||||
static String DebugStackPrefix;
|
||||
|
||||
/**
|
||||
* Flag to indicate debug trace info should be from the calling application
|
||||
* Flag to indicate debug trace info should be from the calling application
|
||||
* point of view (true if DebugStackPrefix is set.)
|
||||
*/
|
||||
static boolean TraceFromApplication;
|
||||
@@ -110,39 +110,39 @@ public class DriverSpy implements Driver
|
||||
* SqlTimingWarnThresholdMsec milliseconds to run. See below.
|
||||
*/
|
||||
static boolean SqlTimingWarnThresholdEnabled;
|
||||
|
||||
|
||||
/**
|
||||
* An amount of time in milliseconds for which SQL that executed taking this
|
||||
* long or more to run shall cause a warning message to be generated on the
|
||||
* An amount of time in milliseconds for which SQL that executed taking this
|
||||
* long or more to run shall cause a warning message to be generated on the
|
||||
* SQL timing logger.
|
||||
*
|
||||
*
|
||||
* This threshold will <i>ONLY</i> be used if SqlTimingWarnThresholdEnabled
|
||||
* is true.
|
||||
* is true.
|
||||
*/
|
||||
static long SqlTimingWarnThresholdMsec;
|
||||
|
||||
|
||||
/**
|
||||
* Flag to indicate if an error should be shown if SQL takes more than
|
||||
* SqlTimingErrorThresholdMsec milliseconds to run. See below.
|
||||
*/
|
||||
static boolean SqlTimingErrorThresholdEnabled;
|
||||
|
||||
|
||||
/**
|
||||
* An amount of time in milliseconds for which SQL that executed taking this
|
||||
* long or more to run shall cause an error message to be generated on the
|
||||
* An amount of time in milliseconds for which SQL that executed taking this
|
||||
* long or more to run shall cause an error message to be generated on the
|
||||
* SQL timing logger.
|
||||
*
|
||||
*
|
||||
* This threshold will <i>ONLY</i> be used if SqlTimingErrorThresholdEnabled
|
||||
* is true.
|
||||
* is true.
|
||||
*/
|
||||
static long SqlTimingErrorThresholdMsec;
|
||||
|
||||
|
||||
/**
|
||||
* Get a Long option from a system property and
|
||||
* Get a Long option from a system property and
|
||||
* log a debug message about this.
|
||||
*
|
||||
*
|
||||
* @param propName System property key.
|
||||
*
|
||||
*
|
||||
* @return the value of that System property key, converted
|
||||
* to a Long. Or null if not defined or is invalid.
|
||||
*/
|
||||
@@ -163,7 +163,7 @@ public class DriverSpy implements Driver
|
||||
}
|
||||
catch (NumberFormatException n)
|
||||
{
|
||||
log.debug("x " + propName + " \"" + propValue +
|
||||
log.debug("x " + propName + " \"" + propValue +
|
||||
"\" is not a valid long value");
|
||||
}
|
||||
}
|
||||
@@ -171,9 +171,9 @@ public class DriverSpy implements Driver
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a String option from a system property and
|
||||
* Get a String option from a system property and
|
||||
* log a debug message about this.
|
||||
*
|
||||
*
|
||||
* @param propName System property key.
|
||||
* @return the value of that System property key.
|
||||
*/
|
||||
@@ -191,7 +191,7 @@ public class DriverSpy implements Driver
|
||||
}
|
||||
return propValue;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
{
|
||||
log.debug("... log4jdbc initializing ...");
|
||||
@@ -213,9 +213,9 @@ public class DriverSpy implements Driver
|
||||
{
|
||||
SqlTimingErrorThresholdMsec = thresh.longValue();
|
||||
}
|
||||
|
||||
// The Set of drivers that the log4jdbc driver will preload at instantiation
|
||||
// time. The driver can spy on any driver type, it's just a little bit
|
||||
|
||||
// The Set of drivers that the log4jdbc driver will preload at instantiation
|
||||
// time. The driver can spy on any driver type, it's just a little bit
|
||||
// easier to configure log4jdbc if it's one of these types!
|
||||
|
||||
Set subDrivers = new TreeSet();
|
||||
@@ -269,7 +269,7 @@ public class DriverSpy implements Driver
|
||||
Class.forName(driverClass);
|
||||
log.debug(" FOUND DRIVER " + driverClass);
|
||||
}
|
||||
catch (ClassNotFoundException c)
|
||||
catch (Throwable c)
|
||||
{
|
||||
i.remove();
|
||||
}
|
||||
@@ -285,10 +285,10 @@ public class DriverSpy implements Driver
|
||||
|
||||
/** create lookup Map for specific rdbms formatters */
|
||||
rdbmsSpecifics = new HashMap();
|
||||
rdbmsSpecifics.put("oracle.jdbc.driver.OracleDriver",
|
||||
rdbmsSpecifics.put("oracle.jdbc.driver.OracleDriver",
|
||||
new OracleRdbmsSpecifics());
|
||||
rdbmsSpecifics.put("net.sourceforge.jtds.jdbc.Driver", sqlServer);
|
||||
rdbmsSpecifics.put("com.microsoft.jdbc.sqlserver.SQLServerDriver",
|
||||
rdbmsSpecifics.put("com.microsoft.jdbc.sqlserver.SQLServerDriver",
|
||||
sqlServer);
|
||||
rdbmsSpecifics.put("weblogic.jdbc.sqlserver.SQLServerDriver", sqlServer);
|
||||
|
||||
@@ -338,8 +338,8 @@ public class DriverSpy implements Driver
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the major version of the driver. This call will be delegated to the
|
||||
* underlying driver that is being spied upon (if there is no underlying
|
||||
* Get the major version of the driver. This call will be delegated to the
|
||||
* underlying driver that is being spied upon (if there is no underlying
|
||||
* driver found, then 1 will be returned.)
|
||||
*
|
||||
* @return the major version of the JDBC driver.
|
||||
@@ -357,8 +357,8 @@ public class DriverSpy implements Driver
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the minor version of the driver. This call will be delegated to the
|
||||
* underlying driver that is being spied upon (if there is no underlying
|
||||
* Get the minor version of the driver. This call will be delegated to the
|
||||
* underlying driver that is being spied upon (if there is no underlying
|
||||
* driver found, then 0 will be returned.)
|
||||
*
|
||||
* @return the minor version of the JDBC driver.
|
||||
@@ -376,16 +376,16 @@ public class DriverSpy implements Driver
|
||||
}
|
||||
|
||||
/**
|
||||
* Report whether the underlying driver is JDBC compliant. If there is no
|
||||
* underlying driver, false will be returned, because the driver cannot
|
||||
* Report whether the underlying driver is JDBC compliant. If there is no
|
||||
* underlying driver, false will be returned, because the driver cannot
|
||||
* actually do any work without an underlying driver.
|
||||
*
|
||||
* @return <code>true</code> if the underlying driver is JDBC Compliant;
|
||||
* @return <code>true</code> if the underlying driver is JDBC Compliant;
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
public boolean jdbcCompliant()
|
||||
{
|
||||
return lastUnderlyingDriverRequested != null &&
|
||||
return lastUnderlyingDriverRequested != null &&
|
||||
lastUnderlyingDriverRequested.jdbcCompliant();
|
||||
}
|
||||
|
||||
@@ -394,9 +394,9 @@ public class DriverSpy implements Driver
|
||||
* an underlying driver that this DriverSpy can spy on.
|
||||
*
|
||||
* @param url JDBC URL.
|
||||
*
|
||||
*
|
||||
* @return true if this Driver can handle the URL.
|
||||
*
|
||||
*
|
||||
* @throws SQLException if a database access error occurs
|
||||
*/
|
||||
public boolean acceptsURL(String url) throws SQLException
|
||||
@@ -418,11 +418,11 @@ public class DriverSpy implements Driver
|
||||
* that accepts the URL.
|
||||
*
|
||||
* @param url JDBC connection URL.
|
||||
*
|
||||
*
|
||||
* @return Underlying driver for the given URL. Null is returned if the URL is
|
||||
* not a <code>jdbc:log4</code> type URL or there is no underlying
|
||||
* not a <code>jdbc:log4</code> type URL or there is no underlying
|
||||
* driver that accepts the URL.
|
||||
*
|
||||
*
|
||||
* @throws SQLException if a database access error occurs.
|
||||
*/
|
||||
private Driver getUnderlyingDriver(String url) throws SQLException
|
||||
@@ -458,10 +458,10 @@ public class DriverSpy implements Driver
|
||||
* @param info a list of arbitrary string tag/value pairs as
|
||||
* connection arguments. Normally at least a "user" and
|
||||
* "password" property should be included.
|
||||
*
|
||||
*
|
||||
* @return a <code>Connection</code> object that represents a
|
||||
* connection to the URL.
|
||||
*
|
||||
*
|
||||
* @throws SQLException if a database access error occurs
|
||||
*/
|
||||
public Connection connect(String url, Properties info) throws SQLException
|
||||
@@ -510,7 +510,7 @@ public class DriverSpy implements Driver
|
||||
* Gets information about the possible properties for the underlying driver.
|
||||
*
|
||||
* @param url the URL of the database to which to connect
|
||||
*
|
||||
*
|
||||
* @param info a proposed list of tag/value pairs that will be sent on
|
||||
* connect open
|
||||
* @return an array of <code>DriverPropertyInfo</code> objects describing
|
||||
@@ -519,7 +519,7 @@ public class DriverSpy implements Driver
|
||||
*
|
||||
* @throws SQLException if a database access error occurs
|
||||
*/
|
||||
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
|
||||
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
|
||||
throws SQLException
|
||||
{
|
||||
Driver d = getUnderlyingDriver(url);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007 Arthur Blake
|
||||
* Copyright 2007-2008 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007 Arthur Blake
|
||||
* Copyright 2007-2008 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,7 +27,7 @@ import java.util.Arrays;
|
||||
* Name of log file is passed in on the command line as the only argument.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
*
|
||||
* 1. Each sql statement in the log is separated by a blank line.
|
||||
* 2. Each sql statement is terminated with the timing string "{executed in N msec}" where N is the number of
|
||||
* milliseconds that the sql executed in.
|
||||
@@ -243,7 +243,7 @@ public class PostLogProfilerProcessor {
|
||||
* than, equal to, or greater than the specified object.<p>
|
||||
*
|
||||
* In this case the comparison is used to sort flagged sql in descending order.
|
||||
* @param o ProfiledSql Object to compare to this ProfiledSql. Must not be null.
|
||||
* @param o ProfiledSql Object to compare to this ProfiledSql. Must not be null.
|
||||
*/
|
||||
public int compareTo(Object o) {
|
||||
return ((ProfiledSql)o).execTime.compareTo(execTime);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007 Arthur Blake
|
||||
* Copyright 2007-2008 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007 Arthur Blake
|
||||
* Copyright 2007-2008 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007 Arthur Blake
|
||||
* Copyright 2007-2008 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007 Arthur Blake
|
||||
* Copyright 2007-2008 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -196,22 +196,22 @@ public class Slf4jSpyLogDelegator implements SpyLogDelegator
|
||||
* Special call that is called only for JDBC method calls that contain SQL.
|
||||
*
|
||||
* @param spy the Spy wrapping the class where the SQL occurred.
|
||||
*
|
||||
*
|
||||
* @param execTime how long it took the SQL to run, in milliseconds.
|
||||
*
|
||||
* @param methodCall a description of the name and call parameters of the
|
||||
*
|
||||
* @param methodCall a description of the name and call parameters of the
|
||||
* method that generated the SQL.
|
||||
*
|
||||
*
|
||||
* @param sql SQL that occurred.
|
||||
*/
|
||||
public void sqlTimingOccured(Spy spy, long execTime, String methodCall, String sql)
|
||||
{
|
||||
// un-comment to simulate random delay to make testing easier
|
||||
//execTime = execTime + (long)(Math.random() * 5000);
|
||||
|
||||
|
||||
if (sqlTimingLogger.isErrorEnabled())
|
||||
{
|
||||
if (DriverSpy.SqlTimingErrorThresholdEnabled &&
|
||||
if (DriverSpy.SqlTimingErrorThresholdEnabled &&
|
||||
execTime >= DriverSpy.SqlTimingErrorThresholdMsec)
|
||||
{
|
||||
sqlTimingLogger.error(
|
||||
@@ -224,7 +224,7 @@ public class Slf4jSpyLogDelegator implements SpyLogDelegator
|
||||
{
|
||||
sqlTimingLogger.warn(
|
||||
buildSqlTimingDump(spy, execTime, methodCall, sql, true));
|
||||
}
|
||||
}
|
||||
else if (sqlTimingLogger.isDebugEnabled())
|
||||
{
|
||||
sqlTimingLogger.debug(
|
||||
@@ -242,21 +242,21 @@ public class Slf4jSpyLogDelegator implements SpyLogDelegator
|
||||
/**
|
||||
* Helper method to quickly build a SQL timing dump output String for
|
||||
* logging.
|
||||
*
|
||||
*
|
||||
* @param spy the Spy wrapping the class where the SQL occurred.
|
||||
*
|
||||
*
|
||||
* @param execTime how long it took the SQL to run, in milliseconds.
|
||||
*
|
||||
* @param methodCall a description of the name and call parameters of the
|
||||
*
|
||||
* @param methodCall a description of the name and call parameters of the
|
||||
* method that generated the SQL.
|
||||
*
|
||||
*
|
||||
* @param sql SQL that occurred.
|
||||
*
|
||||
*
|
||||
* @param debugInfo if true, include debug info at the front of the output.
|
||||
*
|
||||
*
|
||||
* @return a SQL timing dump String for logging.
|
||||
*/
|
||||
private String buildSqlTimingDump(Spy spy, long execTime, String methodCall,
|
||||
private String buildSqlTimingDump(Spy spy, long execTime, String methodCall,
|
||||
String sql, boolean debugInfo)
|
||||
{
|
||||
StringBuffer out = new StringBuffer();
|
||||
@@ -268,18 +268,18 @@ public class Slf4jSpyLogDelegator implements SpyLogDelegator
|
||||
out.append(spy.getConnectionNumber());
|
||||
out.append(". ");
|
||||
}
|
||||
|
||||
|
||||
out.append(sql);
|
||||
out.append(" {executed in ");
|
||||
out.append(execTime);
|
||||
out.append(" msec}");
|
||||
|
||||
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get debugging info - the module and line number that called the logger
|
||||
* version that prints the stack trace information from the point just before
|
||||
* version that prints the stack trace information from the point just before
|
||||
* we got it (net.sf.log4jdbc)
|
||||
*
|
||||
* if the optional log4jdbc.debug.stack.prefix system property is defined then
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007 Arthur Blake
|
||||
* Copyright 2007-2008 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user