7 Commits

41 changed files with 9322 additions and 94 deletions
+9
View File
@@ -1,3 +1,12 @@
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 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
+14 -13
View File
@@ -1,17 +1,18 @@
x switch to SLF4J logging facade so that any kind of logging system can be used with log4jdbc --
not just log4j
x need a way to report exceptions in the sql timing log as well as the sql that failed and how long it took to fail.
x include ydoc within javadoc
x NEED TO LOOK INTO how to support isJdbcLoggingEnabled method call for Slf4jSpyLogDelegator
o NEED to test & build for jdk 1.5&1.6 and jdbc 4
o log4layers product? log4jdbc + servlet layer logging, struts layer logging, json-rpc layer logging, request header dump?
o what about jdbc 2 back support??
o configuration that doesn't rely on system properties (jdbc parms?)
o PostLogProfilerProcessor needs to be able to handle exceptions in log, & needs to be more efficient, also needs command
line switches to control the thresholds & counts, etc.
line switches to control the thresholds & counts, etc.
o intelligent array dumper?
o check for more different kinds of JDBC drivers at startup time
o support for data sources
o ALL String concatenation & dumping methods should take place ONLY if logging is ON!!
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
+93 -39
View File
@@ -17,18 +17,21 @@
<a href="#news">news</a> |
<a href="#features">features</a> |
<a href="#usage">usage</a> |
<a href="apidocs/net/sf/log4jdbc/package-summary.html">javadoc</a> |
<a href="#license">license</a> |
<a href="#feedback">feedback</a>
<br>
<a href="apidocs-jdbc3/net/sf/log4jdbc/package-summary.html">javadoc(JDK1.4: JDBC 3)</a> |
<a href="apidocs-jdbc4/net/sf/log4jdbc/package-summary.html">javadoc(JDK1.6: JDBC 4)</a>
</h1>
<p>
<b>log4jdbc</b> is a JDBC driver that can log SQL and/or JDBC calls (and optionally SQL timing information)
for other jdbc drivers using the <a href="http://www.slf4j.org/">Simple Logging Facade For Java</a> (SLF4J) logging system.
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-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 simple logging facade for java is now used instead of log4j directly. See <a href="CHANGES">CHANGES</a> for all the release details.</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! See <a href="CHANGES">CHANGES</a> for all the release details.</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>
<p class="right"><a href="#top">[back to top]</a></p>
@@ -36,14 +39,12 @@ for other jdbc drivers using the <a href="http://www.slf4j.org/">Simple Logging
<ul class="left">
<li>
Easy to drop in and use in existing systems, because it's a standard jdbc driver.
The only other requirement is to have the SLF4J jars and your jdbc driver for your
database.
Full support for JDBC 3 and JDBC 4!
</li>
<li>
Easy to configure, in most cases all you need to do is change the driver class name
and prepend "jdbc:log4" to your existing jdbc url, set up your logging categories and
and prepend <b>"jdbc:log4"</b> to your existing jdbc url, set up your logging categories and
you're ready to go!
</li>
@@ -59,27 +60,79 @@ for other jdbc drivers using the <a href="http://www.slf4j.org/">Simple Logging
be post processed with an included tool to produce profiling report data for quickly
identifying slow SQL in your application..
</li>
<li>
SQL connection number information is generated to help identify connection pooling or
threading problems.
</li>
<li>
Works with any JDBC 3.0 driver, JDK 1.4 and above, and SLF4J 1.x.
Works with any underlying JDBC driver, with JDK 1.4 and above, and SLF4J 1.x.
</li>
</ul>
<p>
This jdbc driver can be "dropped in" to log the SQL and jdbc calls of another JDBC driver.
</p>
<p class="right"><a href="#top">[back to top]</a></p>
<h2><a name="usage"/>usage</h2>
<ol class="left">
<li><p> Set your jdbc driver class to <code>net.sf.log4jdbc.DriverSpy</code> </p>
<li><p> Decide if you need JDBC 3 or JDBC 4 support. The most straightforward way to decide this is:</p>
<ul>
<li>If you are using JDK 1.4 or 1.5, you should use the JDBC 3 version of log4jdbc.</li>
<li>If you are using JDK 1.6 or 1.7, you should use the JDBC 4 version of log4jdbc (even if the actual underlying JDBC driver you are using is a JDBC 3 or older driver).</li>
</ul>
<p>
Currently there are very few actual JDBC 4 drivers on the market. (The only major one that I really know about is Apache Derby aka The Java DB distributed with JDK 1.6.)
JDBC 4 support was added with the JDK 1.6 release and adds many additional features over and above JDBC 3.
However, the log4jdbc JDBC 4.0 driver can wrap a JDBC 3 or older driver and
it's recommended that if you use JDK 1.6 or above, that you use the log4jdbc JDBC 4 driver that is compiled with JDK 1.6.
</p>
<p>
Note that JDBC 2 is not currently supported by log4jdbc (there is an older unreleased version of log4jdbc with JDBC 2 support,
but I decided not to release it because JDBC 3 has been out for so long, I don't anticipate much demand for a JDBC 2 version of
log4jdbc at this point), although if you are using JDK 1.4 and above, the log4jdbc 3.0 or 4.0 driver
should be able to wrap an older JDBC 2 driver as well-- log4jdbc just won't work with Java 1.3 and earlier.
Please <a href="#feedback">email me</a> if you really really want a JDBC 2 version of log4jdbc. If there is enough demand, I may resurrect it.
</p>
</p>
<pre>
Choose and <a href="http://sourceforge.net/project/showfiles.php?group_id=194500&package_id=229335&release_id=527690">download</a> one of the drivers .jar files:
log4jdbc3-1.1alpha2.jar JDBC 3 support for JDK 1.4 , JDK 1.5
log4jdbc4-1.1alpha2.jar JDBC 4 support for JDK 1.6 , JDK 1.7
Place the log4jdbc jar that you choose into your application's classpath.
</pre>
<li><p>Choose which java logging system you will use. </p>
In many cases, you already know this, because it is dictated by your existing application.
log4jdbc uses the Simple Logging Facade for Java (SLF4J) which is a very simple and very flexible little library that lets you pick among many common java logging systems:</p>
<ul>
<li>Log4j</li>
<li>java.util logging in JDK 1.4</li>
<li>logback</li>
<li>Jakarta Commons Logging</li>
</ul>
<p> SLF4J is designed to de-couple your application from the java logging system so you can choose any one you want. This is the same goal of Jakarta Commons Logging. However many people have
had headaches and issues with classloading problems in complex environments using Jakarta Commons Logging. SLF4J solves these problems with it's much simpler design, and you can even integrate
SLF4J to use Jakarta Commons Logging, if you really want to (or are required to) use it.</p>
<pre>
<a href="http://www.slf4j.org/download.html">Download</a> the latest official SLF4J release.
You will need two jars:
slf4j-api-1.4.2.jar (or the latest available version) and
whichever jar you pick depending on the java logging system you choose
Place these two .jar files into your application's classpath.
</pre>
Please read the documentation at the <a target="slf4j" href="http://slf4j.org">SLF4J website</a>. It's really easy to set up!
</a>
<li><p>Set your jdbc driver class to <code>net.sf.log4jdbc.DriverSpy</code> in your application's configuration.</p>
<p>
The underlying driver that is being spied on in many cases will be loaded automatically
without any additional configuration.
@@ -87,21 +140,23 @@ This jdbc driver can be "dropped in" to log the SQL and jdbc calls of another JD
<p>
The log4jdbc "spy" driver will try and load the following popular jdbc drivers:
</p>
<pre>
<pre>
oracle.jdbc.driver.OracleDriver (oracle)
com.sybase.jdbc2.jdbc.SybDriver (sybase)
net.sourceforge.jtds.jdbc.Driver (sourceforge ms sql server driver)
com.microsoft.jdbc.sqlserver.SQLServerDriver (microsoft ms sql server driver)
weblogic.jdbc.sqlserver.SQLServerDriver (weblogic ms sql server driver)
com.informix.jdbc.IfxDriver (informix)
org.apache.derby.jdbc.ClientDriver (apache derby client/server driver)
org.apache.derby.jdbc.EmbeddedDriver (apache derby embedded driver)
oracle.jdbc.driver.OracleDriver (Oracle)
com.sybase.jdbc2.jdbc.SybDriver (Sybase)
net.sourceforge.jtds.jdbc.Driver (SourceForge SQL Server driver)
com.microsoft.jdbc.sqlserver.SQLServerDriver (Microsoft SQL Server driver)
weblogic.jdbc.sqlserver.SQLServerDriver (Weblogic SQL Server driver)
com.informix.jdbc.IfxDriver (Informix)
org.apache.derby.jdbc.ClientDriver (Apache Derby client/server driver)
org.apache.derby.jdbc.EmbeddedDriver (Apache Derby embedded driver)
com.mysql.jdbc.Driver (MySQL)
org.postgresql.Driver (PostgresSQL)
</pre>
<p>
If you want to use a different underlying jdbc driver that is not already in the above supported list,
set a system property, log4jdbc.drivers to the class name of the additional driver. This
can also be a comma separated list of driver class names.
set a system property, <b>log4jdbc.drivers</b> to the class name of the additional driver. This
can also be a comma separated list of driver class names if you need more than one.
</p>
<p>
(optional) <code>-Dlog4jdbc.drivers=&lt;driver&gt;[,&lt;driver&gt;...]</code> If your driver is not one of the common preloaded drivers.
@@ -109,15 +164,12 @@ This jdbc driver can be "dropped in" to log the SQL and jdbc calls of another JD
</li>
<li><p> Prepend <code>jdbc:log4</code> to the normal jdbc url that you are using.</p>
<p>For example, if your normal jdbc url is <code>jdbc:derby://localhost:1527//db-derby-10.2.2.0-bin/databases/MyDatabase</code>
You would change it to: <code>jdbc:log4jdbc:derby://localhost:1527//db-derby-10.2.2.0-bin/databases/MyDatabase</code> to use the
log4jdbc spy driver.</p>
</li>
<li><p>Make sure <span class="file">log4jdbc-1.1alpha1.jar</span> and the <span class="file">slf4j</span> jar files (v1.x) are in
the classpath, as well as the jar file for the logging system that SLF4J forwards to and the jar file(s) for the actual
jdbc driver that is being spied upon. Please refer the the <a href="http://www.slf4j.org/">SLF4J documentation</a>
for information on setting up SLF4J. It's really easy!
</p>
<p>For example, if your normal jdbc url is</p>
<p><code>jdbc:derby://localhost:1527//db-derby-10.2.2.0-bin/databases/MyDatabase</code></p>
<p>then You would change it to: </p>
<p><code><b>jdbc:log4</b>jdbc:derby://localhost:1527//db-derby-10.2.2.0-bin/databases/MyDatabase</code></p>
<p>to use <b>log4jdbc.</b></p>
</li>
<li> <p> Set up your logging categories. There are 4 categories that are used by log4jdbc,
If all 4 loggers are set to a level less than error (such as the FATAL level), then log4jdbc will not log
@@ -144,7 +196,7 @@ This jdbc driver can be "dropped in" to log the SQL and jdbc calls of another JD
jdbc.resultset Even more voluminous, because all calls to ResultSet objects are logged.
</pre>
<p>Additionally, there is one logger named log4jdbc.debug which is for use with internal debugging of log4jdbc.
<p>Additionally, there is one logger named <b>log4jdbc.debug</b> which is for use with internal debugging of log4jdbc.
At this time it just prints out information on which underlying drivers were found and not found when the
log4jdbc spy driver loads.</p>
@@ -183,7 +235,7 @@ This jdbc driver can be "dropped in" to log the SQL and jdbc calls of another JD
this would be printed in the debug information, rather than the package name for a connection pool, object relational system, etc.
</p>
</li>
<li>With the 1.1 alpha 1 release, a new tool is included which you can use to post-process sql timing logs produced by log4jdbc
<li>Starting with the 1.1 alpha 1 release, a new tool was included which you can use to post-process sql timing logs produced by log4jdbc
to produce 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
@@ -212,11 +264,12 @@ log4jdbc is open source software, licensed under the <b>Apache 2.0 license:</b>
<a href="#news">news</a> |
<a href="#features">features</a> |
<a href="#usage">usage</a> |
<a href="apidocs/net/sf/log4jdbc/package-summary.html">javadoc</a> |
<a href="#license">license</a> |
<a href="#feedback">feedback</a>
<br>
<a href="apidocs-jdbc3/net/sf/log4jdbc/package-summary.html">javadoc(JDK1.4: JDBC 3)</a> |
<a href="apidocs-jdbc4/net/sf/log4jdbc/package-summary.html">javadoc(JDK1.6: JDBC 4)</a>
<br>
<img class="logo" src="log4jdbc-logo-gray.png">
</h1>
@@ -227,5 +280,6 @@ 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>
+3 -1
View File
@@ -25,4 +25,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;}
p.ad {font-size:1em;color:blue;}
p.ad {font-size:1em;color:blue;}
.sflogo {float:right; margin-right:30px;}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.
+18
View File
@@ -0,0 +1,18 @@
@echo off
setlocal
rem this is a bit convoluted because two jdk's must be invoked...
set ANT_HOME=c:\apache-ant-1.6.5
set JAVA_HOME=C:\j2sdk1.4.2_13
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin
call java -version
call ant -Djdbc.level=3 all
set JAVA_HOME=c:\jdk1.6.0
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin
call java -version
call ant -Djdbc.level=4 all
+116 -32
View File
@@ -3,26 +3,58 @@
<!--
Ant build script for log4jdbc
Tested with Apache Ant version 1.6.5
Tested with Apache Ant version 1.6.5 & 1.7
built with jdk 1.4.2_13
built with jdk 1.4.2_13 (for use with jdbc3)
and/or jdk 1.6.0 (for use with jdbc4)
-->
<project name="log4jdbc" default="all" basedir="..">
<target name="all" depends="cleancompile,compile,cleanjar,jar"/>
<!-- the jdbc.level flag should be set externally to either 3 or 4
the is the jdbc version and should be 3 if using a jdk 1.4 (or 1.5) (1.4 is recommended for maximum compatibility)
the jdbc.level flag should be set to 4 if using a jdk 1.6 or greater.
defaults to jdbc3 build if not set externally
-->
<property name="jdbc.level" value="3" />
<property name="jdbc.prefix" value="jdbc${jdbc.level}" />
<property name="src" value="src-${jdbc.prefix}" />
<property name="classes" value="classes-${jdbc.prefix}" />
<property name="apidocs" value="doc/apidocs-${jdbc.prefix}" />
<!-- release version -->
<property name="version" value="1.1alpha1"/>
<property name="version" value="1.1alpha2"/>
<!-- ydoc.home is only used for ydoc target for producing javadoc with generated UML
requires the NON-FREE ydoc utility
(use the javadoc target to generate regular javadoc)
<target name="all" depends="cleancompile,compile,cleanjar,jar"/>
<!--
note that if jdbc.level is 3, a jdk 1.4 compiler should be used to build log4jdbc
and if the jdbc.level is 4, a jdk 1.6 compiler should be used to build log4jdbc
therefore to build both, ant should be invoked twice, setting the jdbc.level externally
to 3 and then 4. and using the jdk 1.4 and then 1.6.
jdbc.level is explicitly set here to xxx so that the user is forced to set it externally.
-->
<property name="ydoc.home" value="/ydoc-2.2_04"/>
<!-- ydoc.home.X is only used for the ydoc.X targets for producing javadoc with UML
it requires the commercial ydoc utility (see http://www.yworks.com/en/products_ydoc.htm)
(use the javadoc target to generate regular javadoc)
ydoc.home.3 is for jdk1.4 / JDBC 3
ydoc.home.4 is for jdk1.6 / JDBC 4
-->
<property name="ydoc.home.3" value="/ydoc-2.2_04"/>
<property name="ydoc.home.4" value="/ydoc-2.2_04-jdk1.5"/>
<target name="compile" description="compile all the source code">
<javac srcdir="src" destdir="classes" deprecation="true" debug="true">
<javac srcdir="${src}" destdir="${classes}" deprecation="true" debug="true">
<classpath>
<pathelement location="$src"/>
<fileset dir="lib">
@@ -33,23 +65,23 @@
</target>
<target name="cleancompile" description="delete all the .class files.">
<delete dir="classes"/>
<mkdir dir="classes"/>
<delete dir="${classes}"/>
<mkdir dir="${classes}"/>
</target>
<target name="jar" description="jar up all the class files">
<mkdir dir="build"/>
<jar jarfile="build/log4jdbc-${version}.jar" basedir="classes"/>
<jar jarfile="build/log4${jdbc.prefix}-${version}.jar" basedir="${classes}"/>
</target>
<target name="cleanjar" description="delete the jar file">
<delete file="build/log4jdbc-${version}.jar" description="delete the jar file"/>
<delete file="build/log4${jdbc.prefix}-${version}.jar" description="delete the jar file"/>
</target>
<target name="cleanjavadoc">
<delete dir="doc/apidocs" />
<mkdir dir="doc/apidocs" />
<delete dir="${apidocs}" />
<mkdir dir="${apidocs}" />
</target>
<target name="cleanrelease">
@@ -58,12 +90,12 @@
<delete file="../log4jdbc-${version}.tar.gz"/>
</target>
<target name="release" depends="cleanrelease,all,ydoc" description="make a complete release distribution (a .jar zip and tar.gz file for release)">
<target name="release" depends="cleanrelease" description="make a complete release distribution (a .jar zip and tar.gz file for release)">
<zip destfile="../log4jdbc-${version}.zip">
<zipfileset dir="." prefix="log4jdbc-${version}" excludes="*.zip,*.tar.gz,*,iml,*.ipr,*.iws,thirdparty-stuff/**,classes/**"/>
<zipfileset dir="." prefix="log4jdbc-${version}" excludes="*.zip,*.tar.gz,*,iml,*.ipr,*.iws,thirdparty-stuff/**,classes*/**"/>
</zip>
<tar destfile="../log4jdbc-${version}.tar">
<tarfileset dir="." prefix="log4jdbc-${version}" excludes="*.zip,*.tar.gz,*,iml,*.ipr,*.iws,thirdparty-stuff/**,classes/**"/>
<tarfileset dir="." prefix="log4jdbc-${version}" excludes="*.zip,*.tar.gz,*,iml,*.ipr,*.iws,thirdparty-stuff/**,classes*/**"/>
</tar>
<gzip destfile="../log4jdbc-${version}.tar.gz" src="../log4jdbc-${version}.tar"/>
<delete file="../log4jdbc-${version}.tar"/>
@@ -72,11 +104,11 @@
<!-- make the javadoc (or ydoc which includes UML diagrams) -->
<target name="javadoc" description="generate the javadoc" depends="cleanjavadoc">
<delete dir="doc/apidocs" />
<mkdir dir="doc/apidocs" />
<javadoc destdir="doc/apidocs" packagenames="net.sf.log4jdbc.*"
Windowtitle="log4jdbc ${version}"
Header="&lt;b&gt;&lt;a href=&quot;http://log4jdbc.sourceforge.net&quot;&gt;log4jdbc ${version}&lt;/a&gt;&lt;/b&gt;"
<delete dir="${apidocs}" />
<mkdir dir="${apidocs}" />
<javadoc destdir="${apidocs}" packagenames="net.sf.log4jdbc.*"
Windowtitle="log4${jdbc.prefix} ${version}"
Header="&lt;b&gt;&lt;a href=&quot;http://log4jdbc.sourceforge.net&quot;&gt;log4${jdbc.prefix} ${version}&lt;/a&gt;&lt;/b&gt;"
Use="true" breakiterator="true">
<classpath>
<pathelement location="$src"/>
@@ -84,24 +116,26 @@
<include name="**/*.jar"/>
</fileset>
</classpath>
<sourcepath path="src"/>
<sourcepath path="${src}"/>
<!-- 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="/j2sdk1.4.2_13/src"/>
<link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
<link href="http://java.sun.com/j2ee/1.4/docs/api/"/>
<link href="http://www.slf4j.org/api/"/>
-->
</javadoc>
</target>
<target name="ydoc" description="create javadoc using ydoc doclet to include UML diagrams" depends="cleanjavadoc">
<target name="ydoc.3" description="(jdk1.4/JDBC3 version) create javadoc using ydoc doclet to include UML diagrams" depends="cleanjavadoc">
<property name="ps" value="${path.separator}"/>
<property name="ps" value="${path.separator}" />
<javadoc destdir="doc/apidocs" packagenames="net.sf.log4jdbc.*"
Windowtitle="log4jdbc ${version}"
Header="&lt;b&gt;&lt;a href=&quot;http://log4jdbc.sourceforge.net&quot;&gt;log4jdbc ${version}&lt;/a&gt;&lt;/b&gt;"
<javadoc destdir="${apidocs}" packagenames="net.sf.log4jdbc.*"
Windowtitle="log4${jdbc.prefix} ${version}"
Header="&lt;b&gt;&lt;a href=&quot;http://log4jdbc.sourceforge.net&quot;&gt;log4${jdbc.prefix} ${version}&lt;/a&gt;&lt;/b&gt;"
Use="true" breakiterator="true">
<classpath>
<pathelement location="$src"/>
@@ -109,22 +143,25 @@
<include name="**/*.jar"/>
</fileset>
</classpath>
<sourcepath path="src"/>
<sourcepath path="${src}"/>
<!-- 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="/j2sdk1.4.2_13/src"/>
<link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
<!--
<link href="http://java.sun.com/j2ee/1.4/docs/api/"/>
-->
<link href="http://www.slf4j.org/api/"/>
<!-- ydoc doclet for UML diagrams, see http://www.yworks.com/en/products_ydoc.htm -->
<doclet name="ydoc.doclets.YStandard"
path="${ydoc.home}/lib/ydoc.jar${ps}${ydoc.home}/lib/class2svg.jar${ps}${ydoc.home}/resources${ps}${ydoc.home}/doc${ps}./classes">
path="${ydoc.home.3}/lib/ydoc.jar${ps}${ydoc.home.3}/lib/class2svg.jar${ps}${ydoc.home.3}/resources${ps}${ydoc.home.3}/doc${ps}./${classes}">
<param name="-author"/>
<param name="-generic"/>
<param name="-umlautogen"/>
<param name="-filterpath" value="${ydoc.home}/lib/ydoc.jar"/>
<param name="-filterpath" value="${ydoc.home.3}/lib/ydoc.jar"/>
<param name="-filter" value="ydoc.filters.ExcludeFilter"/>
<param name="-tag" value="y.precondition"/>
<param name="-tag" value="y.postcondition"/>
@@ -138,4 +175,51 @@
</javadoc>
</target>
<target name="ydoc.4" description="(jdk1.6/JDBC4 version) create javadoc using ydoc doclet to include UML diagrams" depends="cleanjavadoc">
<property name="ps" value="${path.separator}"/>
<javadoc destdir="${apidocs}" packagenames="net.sf.log4jdbc.*"
Windowtitle="log4${jdbc.prefix} ${version}"
Header="&lt;b&gt;&lt;a href=&quot;http://log4jdbc.sourceforge.net&quot;&gt;log4${jdbc.prefix} ${version}&lt;/a&gt;&lt;/b&gt;"
Use="true" breakiterator="true">
<classpath>
<pathelement location="$src"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
<sourcepath path="${src}"/>
<!-- 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"/>
<link href="http://java.sun.com/javase/6/docs/api/"/>
<!--
<link href="http://java.sun.com/j2ee/1.4/docs/api/"/>
-->
<link href="http://www.slf4j.org/api/"/>
<!-- ydoc doclet for UML diagrams, see http://www.yworks.com/en/products_ydoc.htm -->
<doclet name="ydoc.doclets.YStandard"
path="${ydoc.home.4}/lib/ydoc.jar${ps}${ydoc.home.4}/lib/class2svg.jar${ps}${ydoc.home.4}/resources${ps}${ydoc.home.4}/doc${ps}./${classes}">
<param name="-author"/>
<param name="-generic"/>
<param name="-umlautogen"/>
<param name="-filterpath" value="${ydoc.home.4}/lib/ydoc.jar"/>
<param name="-filter" value="ydoc.filters.ExcludeFilter"/>
<param name="-tag" value="y.precondition"/>
<param name="-tag" value="y.postcondition"/>
<param name="-tag" value="y.complexity"/>
<param name="-tag" value="param"/>
<param name="-tag" value="return"/>
<param name="-tag" value="see"/>
<param name="-tag" value="y.uml"/>
<param name="-linksource" value="true"/>
</doclet>
</javadoc>
</target>
</project>
+19
View File
@@ -0,0 +1,19 @@
@echo off
setlocal
rem run ydoc for jdbc 3 with jdk 1.4 and
rem run ydoc for jdbc 4 with jdk 1.6
set ANT_HOME=c:\apache-ant-1.6.5
set JAVA_HOME=C:\j2sdk1.4.2_13
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin
call java -version
call ant -Djdbc.level=3 ydoc.3
set JAVA_HOME=c:\jdk1.6.0
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin
call java -version
call ant -Djdbc.level=4 ydoc.4
@@ -46,6 +46,29 @@ public class ConnectionSpy implements Connection, Spy
*/
public ConnectionSpy(Connection realConnection)
{
setRdbmsSpecifics(DriverSpy.defaultRdbmsSpecifics); // just in case it's not initialized
if (realConnection == null)
{
throw new IllegalArgumentException("Must pass in a non null real Connection");
}
this.realConnection = realConnection;
log = SpyLogFactory.getSpyLogDelegator();
synchronized (connectionNumberLock)
{
connectionNumber = ++lastConnectionNumber;
}
}
/**
* Create a new ConnectionSpy that wraps a given Connection.
*
* @param realConnection &quot;real&quot; Connection that this ConnectionSpy wraps.
* @param rdbmsSpecifics the RdbmsSpecifics object for formatting logging appropriate for the Rdbms used.
*/
public ConnectionSpy(Connection realConnection, RdbmsSpecifics rdbmsSpecifics)
{
setRdbmsSpecifics(rdbmsSpecifics);
if (realConnection == null)
{
throw new IllegalArgumentException("Must pass in a non null real Connection");
@@ -404,7 +427,7 @@ public class ConnectionSpy implements Connection, Spy
String methodCall = "isReadOnly()";
try
{
return realConnection.isReadOnly();
return reportReturn(methodCall,realConnection.isReadOnly());
}
catch (SQLException s)
{
@@ -549,6 +572,7 @@ public class ConnectionSpy implements Connection, Spy
public void setTypeMap(java.util.Map map) throws SQLException
{
//todo: dump map?
String methodCall = "setTypeMap(" + map + ")";
try
{
@@ -120,6 +120,8 @@ public class DriverSpy implements Driver
subDrivers.add("com.informix.jdbc.IfxDriver");
subDrivers.add("org.apache.derby.jdbc.ClientDriver");
subDrivers.add("org.apache.derby.jdbc.EmbeddedDriver");
subDrivers.add("com.mysql.jdbc.Driver");
subDrivers.add("org.postgresql.Driver");
// look for additional driver specified in system properties
String moreDrivers = System.getProperty("log4jdbc.drivers");
@@ -158,7 +160,6 @@ public class DriverSpy implements Driver
}
catch (ClassNotFoundException c)
{
// log.debug(" ... (not found) ..." + driverClass);
i.remove();
}
}
@@ -261,8 +262,10 @@ public class DriverSpy implements Driver
}
/**
* Report whether the underlying driver is jdbcClient. If there is no underlying driver, false
* will be returned, because the driver cannot actually do any work without an underlying driver.
* 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; <code>false</code>
* otherwise.
@@ -34,6 +34,7 @@ import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.StringTokenizer;
import java.util.List;
/**
* Wraps a PreparedStatement and reports method calls, returns and exceptions.
@@ -48,7 +49,7 @@ public class PreparedStatementSpy extends StatementSpy implements PreparedStatem
/**
* holds list of bind variables for tracing
*/
protected final ArrayList argTrace = new ArrayList();
protected final List argTrace = new ArrayList();
// a way to turn on and off type help...
// todo: make this a configurable parameter
@@ -226,7 +227,7 @@ public class PreparedStatementSpy extends StatementSpy implements PreparedStatem
public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException
{
String methodCall = "setCharacterStream(" + parameterIndex + ", " + reader + ", " + length + ")";
argTraceSet(parameterIndex, "(CharacterStream)", reader + ":" + length);
argTraceSet(parameterIndex, "(Reader)", "<Reader of length " + length + ">");
try
{
realPreparedStatement.setCharacterStream(parameterIndex, reader, length);
@@ -620,10 +621,22 @@ public class PreparedStatementSpy extends StatementSpy implements PreparedStatem
}
}
private String getTypeHelp(Object x)
{
if (x==null)
{
return "(null)";
}
else
{
return "(" + x.getClass().getName() + ")";
}
}
public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException
{
String methodCall = "setObject(" + parameterIndex + ", " + x + ", " + targetSqlType + ", " + scale + ")";
argTraceSet(parameterIndex, "(" + x.getClass().getName() + ")", rdbmsSpecifics.formatParameterObject(x));
argTraceSet(parameterIndex, getTypeHelp(x), rdbmsSpecifics.formatParameterObject(x));
try
{
@@ -640,7 +653,7 @@ public class PreparedStatementSpy extends StatementSpy implements PreparedStatem
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException
{
String methodCall = "setObject(" + parameterIndex + ", " + x + ", " + targetSqlType + ")";
argTraceSet(parameterIndex, "(" + x.getClass().getName() + ")", rdbmsSpecifics.formatParameterObject(x));
argTraceSet(parameterIndex, getTypeHelp(x), rdbmsSpecifics.formatParameterObject(x));
try
{
realPreparedStatement.setObject(parameterIndex, x, targetSqlType);
@@ -656,7 +669,7 @@ public class PreparedStatementSpy extends StatementSpy implements PreparedStatem
public void setObject(int parameterIndex, Object x) throws SQLException
{
String methodCall = "setObject(" + parameterIndex + ", " + x + ")";
argTraceSet(parameterIndex, "(" + x.getClass().getName() + ")", rdbmsSpecifics.formatParameterObject(x));
argTraceSet(parameterIndex, getTypeHelp(x), rdbmsSpecifics.formatParameterObject(x));
try
{
realPreparedStatement.setObject(parameterIndex, x);

Some files were not shown because too many files have changed in this diff Show More