mirror of
https://github.com/encounter/log4jdbc.git
synced 2026-03-30 11:27:21 -07:00
Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 93d265316f | |||
| 2ab2d0389e | |||
| f4f264f921 | |||
| 3604fe043c | |||
| 6a9b4e1948 | |||
| bff4f67db8 | |||
| dc6edbdb86 | |||
| f637d041cc | |||
| 7d51cd3d3f | |||
| 77507faf9c | |||
| 8918e4a39a | |||
| d308e26494 | |||
| 053afdbf0f | |||
| d3c58ab5cd | |||
| 35b5548e2f | |||
| ab522b45e2 | |||
| 1f47f9a899 | |||
| f7a51cd827 | |||
| e261132179 | |||
| ee5468cfe6 | |||
| 88f90f8131 | |||
| 7f7d2f0f3b | |||
| d430b481a4 | |||
| 48154128a9 | |||
| dbc63df301 | |||
| 59ecc4ac8b | |||
| d10afb244f | |||
| c183dc2b5d | |||
| a3ac1c68c1 | |||
| 46c13d8498 | |||
| 6906f31ba5 | |||
| d3a48845f3 | |||
| 7355247886 | |||
| 00369eba9f | |||
| a02f682e7c | |||
| a5290edf4b | |||
| 9769dbc6dd | |||
| b0b69fdc64 | |||
| 1dd40a2f76 | |||
| bbf255e0b4 | |||
| 4ee6d5f745 | |||
| c83e89c194 | |||
| 5ac146eb77 | |||
| cab8caa20a | |||
| 6484ab0c10 | |||
| de7d4acc84 | |||
| 108d89b8bc | |||
| 076a585184 | |||
| 1d455b77e6 | |||
| e33eb5534f | |||
| 15a798c27a | |||
| e227d3ca26 | |||
| 98f98d605c | |||
| c19443a574 | |||
| de256617a2 | |||
| eac61725f6 | |||
| f7fa0cdaf4 |
@@ -0,0 +1,8 @@
|
||||
# log4jdbc
|
||||
A more extensive README will be created soon. For now, you can view the usage instructions at the old Google Code hosting site:
|
||||
|
||||
https://code.google.com/p/log4jdbc/
|
||||
|
||||
You can download the prebuilt jars at:
|
||||
|
||||
https://code.google.com/p/log4jdbc/downloads/list
|
||||
+77
@@ -1,3 +1,80 @@
|
||||
2015-09-30 1.3 release
|
||||
|
||||
o add new option, "log4jdbc.trim.sql.lines" which when set,
|
||||
will trim SQL line by line (for beginning of line, only trimming
|
||||
consistent white space) If this option is selected, the TrimSql
|
||||
option will be ignored.
|
||||
|
||||
o remove JDBC 3 version (not all scripts updated yet.)
|
||||
|
||||
o getArray method improperly labeled as getURL (Issue 61.)
|
||||
|
||||
o bug fix ResultSetSpy.getStatement should return wrapped Statement,
|
||||
not real Statement (Issue 55.)
|
||||
|
||||
o move to GitHub (Google Code shutting down.)
|
||||
|
||||
2012-02-17 1.2 Release
|
||||
|
||||
o escape single quotes in PreparedStatement/CallableStatement bind variables (Issue 36.)
|
||||
|
||||
o process SQL consistently when the sql is dumped because an exception occurred.
|
||||
|
||||
o new SQL formatter to more reliably dump sql that can be run for MySql (Issue 34.)
|
||||
|
||||
o don't show debug info in sql timing dump unless debug is enabled on the logger
|
||||
(to make the sql timing dump consistent with the way other the loggers work)
|
||||
|
||||
o add new option, log4jdbc.trim.sql.extrablanklines for removing
|
||||
extra blank lines from sql output.
|
||||
|
||||
o fix issue where extra connection was being created when
|
||||
ResultSet.getStatement was being called (Issue 33.)
|
||||
|
||||
o performance enhancement when logging not enabled (Issue 29.)
|
||||
|
||||
2010-06-09 1.2 beta 2 Release
|
||||
|
||||
o add new option, log4jdbc.auto.load.popular.drivers for
|
||||
disabling auto-loading of drivers
|
||||
|
||||
o look first for log4jdbc property settings in optional
|
||||
log4jdbc.properties file in the classpath.
|
||||
|
||||
o Fix non-threadsafe usage of SimpleDateFormat (Issue 18)
|
||||
|
||||
o add new option, log4jdbc.trim.sql to trim the SQL before logging
|
||||
it.
|
||||
|
||||
o add new option, log4jdbc.suppress.generated.keys.exception that
|
||||
will ignore any exception produced by the method,
|
||||
Statement.getGeneratedKeys(). This flag is useful in Coldfusion
|
||||
environments which typically call this method after every update,
|
||||
even if unwarranted, and ignoring the exception, thus clogging up
|
||||
the logs with these exception reports.
|
||||
|
||||
o add support for the newer oracle.jdbc.OracleDriver driver (the
|
||||
older oracle.jdbc.driver.OracleDriver driver is still supported
|
||||
as well) and add corrected date formatting for Oracle.
|
||||
|
||||
o fix possible null pointer issue with setBlob and setClob (Issue 21)
|
||||
|
||||
2010-03-20 1.2 beta 1 Release
|
||||
|
||||
o Check for exception that should not, but in some cases could
|
||||
occur when trying to format parameter arguments.
|
||||
|
||||
o Use only one type of date format so that time portion of Date
|
||||
types is not dropped!
|
||||
|
||||
o use to_date function for Oracle (Issue 14)
|
||||
|
||||
o performance improvements
|
||||
|
||||
o fix: respect DumpSqlMaxLineLength option.
|
||||
|
||||
o various other fixes (including Issues 8 and 9)
|
||||
|
||||
2009-02-26 1.2 alpha 2 Release
|
||||
|
||||
o (Issue 1) fix bug where batch of logged SQL wasn't cleared
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
log4jdbc is open source software, released under the Apache License, Version 2.0:
|
||||
|
||||
Copyright 2007-2008 Arthur Blake
|
||||
Copyright 2007-2011 Arthur Blake
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use log4jdbc except in compliance with the License.
|
||||
|
||||
@@ -18,3 +18,5 @@ o review dumpedSql method - make auto line breaking option (& num chars used) b
|
||||
o need log4jdbc.debug.stack.regex so that the stack matching can take place via regex
|
||||
|
||||
o maven2 repository support
|
||||
|
||||
o this may be a better solution to SimpleDateFormat contention issue: http://www.javaspecialists.eu/archive/Issue172.html
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,41 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.googlecode.log4jdbc</groupId>
|
||||
<artifactId>log4jdbc</artifactId>
|
||||
<version>1.3-SNAPSHOT</version>
|
||||
<name>log4jdbc</name>
|
||||
<description>log4jdbc is a Java JDBC driver that can log SQL and/or JDBC calls (and optionally SQL timing information) for other JDBC drivers using the Simple Logging Facade For Java (SLF4J) logging system.</description>
|
||||
<url>https://github.com/arthurblake/log4jdbc</url>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
<comments>A business-friendly OSS license</comments>
|
||||
</license>
|
||||
</licenses>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.6.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<sourceDirectory>src-jdbc41</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
+7
-4
@@ -1,5 +1,8 @@
|
||||
To build log4jdbc, you must have Ant 1.6.5 or later installed,
|
||||
and JDK 1.4 and JDK 1.6 installed.
|
||||
log4jdbc is built with Ant 1.8.x and JDK 1.6.x
|
||||
|
||||
The build.cmd file is useful for building both the jdbc 3 version (JDK 1.4) and the jdbc 4 version (under JDK 1.6) under windows.
|
||||
The javadoc.cmd file is useful for building javadoc (requires the 3rd party ydoc tool)
|
||||
The build.cmd file is useful for building both the jdbc 3 version (JDK 1.4) and
|
||||
the jdbc 4 version (under JDK 1.6) under windows. The javadoc.cmd file is
|
||||
useful for building javadoc (requires the 3rd party ydoc tool)
|
||||
|
||||
NOTE: as of 2015-09-30 the jdbc 3 version has been removed - not all build
|
||||
scripts may have been updated to reflect that.
|
||||
|
||||
+4
-11
@@ -1,18 +1,11 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
REM invoke the 1.4 and the 1.6 jvm each in turn
|
||||
REM for JDBC 3 and JDBC 4 versions respectively
|
||||
REM (JDBC 3 version removed as of 2015-09-30)
|
||||
REM invoke the 1.6 jvm for the JDBC 4 version
|
||||
|
||||
set ANT_HOME=c:\apache-ant-1.6.5
|
||||
|
||||
set JAVA_HOME=C:\jdk\1.4.2_18
|
||||
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin
|
||||
|
||||
call java -version
|
||||
call ant -Djdbc.level=3 -Djvm.ver=1.4 all
|
||||
|
||||
set JAVA_HOME=C:\jdk\1.6.0_11
|
||||
set ANT_HOME=c:\apache-ant-1.8.1
|
||||
set JAVA_HOME=C:\jdk\1.6.0_21
|
||||
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin
|
||||
|
||||
call java -version
|
||||
|
||||
+9
-14
@@ -9,7 +9,7 @@
|
||||
built with jdk 1.4.2_13 (for use with jdbc3)
|
||||
and/or jdk 1.6.0 (for use with jdbc4)
|
||||
|
||||
Copyright 2007-2009 Arthur Blake
|
||||
Copyright 2007-2015 Arthur Blake
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
|
||||
<!-- release version -->
|
||||
<property name="version" value="1.2alpha2"/>
|
||||
<property name="version" value="1.3"/>
|
||||
|
||||
<target name="all" depends="cleancompile,compile,cleanjar,jar"/>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
|
||||
<target name="compile" description="compile all the source code">
|
||||
<javac source="${jvm.ver}" target="${jvm.ver}" srcdir="${src}" destdir="${classes}"
|
||||
deprecation="true" debug="true">
|
||||
deprecation="true" debug="true" includeAntRuntime="false">
|
||||
<classpath>
|
||||
<pathelement location="$src"/>
|
||||
<fileset dir="lib">
|
||||
@@ -95,26 +95,21 @@
|
||||
</target>
|
||||
|
||||
|
||||
<target name="cleanjavadoc">
|
||||
<target name="cleanjavadoc" description="clean javadoc">
|
||||
<delete dir="${apidocs}" />
|
||||
<mkdir dir="${apidocs}" />
|
||||
</target>
|
||||
|
||||
<target name="cleanrelease">
|
||||
<target name="cleanrelease" description="clean up any release files">
|
||||
<delete file="../log4jdbc-${version}.zip"/>
|
||||
<delete file="../log4jdbc-${version}.tar"/>
|
||||
<delete file="../log4jdbc-${version}.tar.gz"/>
|
||||
</target>
|
||||
|
||||
<target name="clean" depends="cleanrelease,cleanjavadoc,cleanjar,cleancompile" description="clean up all build artifacts"/>
|
||||
|
||||
<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*/**"/>
|
||||
</zip>
|
||||
<tar destfile="../log4jdbc-${version}.tar">
|
||||
<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"/>
|
||||
</target>
|
||||
|
||||
<!-- make the javadoc (or ydoc which includes UML diagrams) -->
|
||||
@@ -164,7 +159,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="/jdk/1.4.2_18/src"/>
|
||||
<sourcepath path="/jdk/1.4.2_19/src"/>
|
||||
<link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
|
||||
<!--
|
||||
<link href="http://java.sun.com/j2ee/1.4/docs/api/"/>
|
||||
@@ -211,7 +206,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="/jdk/1.6.0_11/src"/>
|
||||
<sourcepath path="/jdk/1.6.0_21/src"/>
|
||||
<link href="http://java.sun.com/javase/6/docs/api/"/>
|
||||
<link href="http://www.slf4j.org/api/"/>
|
||||
|
||||
|
||||
+4
-10
@@ -1,19 +1,13 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
REM invoke the 1.4 and the 1.6 jvm each in turn
|
||||
REM for JDBC 3 and JDBC 4 versions respectively
|
||||
REM (JDBC 3 version removed as of 2015-09-30)
|
||||
REM invoke the 1.6 jvm for the JDBC 4 version
|
||||
|
||||
set ANT_HOME=c:\apache-ant-1.6.5
|
||||
set ANT_HOME=c:\apache-ant-1.8.1
|
||||
set ANT_OPTS=-Xmx512m
|
||||
|
||||
set JAVA_HOME=C:\jdk\1.4.2_18
|
||||
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin
|
||||
|
||||
call java -version
|
||||
call ant -Djdbc.level=3 -Djvm.ver=1.4 ydoc.3
|
||||
|
||||
set JAVA_HOME=c:\jdk\1.6.0_11
|
||||
set JAVA_HOME=c:\jdk\1.6.0_21
|
||||
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin
|
||||
|
||||
call java -version
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
rem *************************************************************************************************
|
||||
rem * *
|
||||
rem * Copyright 2007-2009 Arthur Blake *
|
||||
rem * Copyright 2007-2015 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\log4jdbc3-1.2alpha2.jar net.sf.log4jdbc.PostLogProfilerProcessor %*
|
||||
java -Xmx1024m -classpath ..\build\log4jdbc3-1.2.jar net.sf.log4jdbc.PostLogProfilerProcessor %*
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
# *************************************************************************************************
|
||||
# * *
|
||||
# * Copyright 2007-2009 Arthur Blake *
|
||||
# * Copyright 2007-2015 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/log4jdbc3-1.2alpha2.jar net.sf.log4jdbc.PostLogProfilerProcessor $@
|
||||
java -Xmx1024m -classpath ../build/log4jdbc3-1.2.jar net.sf.log4jdbc.PostLogProfilerProcessor $@
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,70 +0,0 @@
|
||||
/**
|
||||
* Copyright 2007-2009 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.
|
||||
*/
|
||||
package net.sf.log4jdbc;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
/**
|
||||
* Formatting for SQL Server databases.
|
||||
*
|
||||
* @author Arthur Blake
|
||||
*/
|
||||
class SqlServerRdbmsSpecifics extends RdbmsSpecifics
|
||||
{
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
SqlServerRdbmsSpecifics()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
private static final DateFormat sqlServerDateFormat = new SimpleDateFormat("MM/dd/yyyy");
|
||||
private static final DateFormat sqlServerTimestampFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss.SSS");
|
||||
|
||||
/**
|
||||
* Format an Object that is being bound to a PreparedStatement parameter, for display. The goal is to reformat the
|
||||
* object in a format that can be re-run against the native SQL client of the particular Rdbms being used. This
|
||||
* class should be extended to provide formatting instances that format objects correctly for different RDBMS
|
||||
* types.
|
||||
*
|
||||
* @param object jdbc object to be formatted.
|
||||
* @return formatted dump of the object.
|
||||
*/
|
||||
String formatParameterObject(Object object)
|
||||
{
|
||||
if (object == null)
|
||||
{
|
||||
return super.formatParameterObject(object);
|
||||
}
|
||||
if (object instanceof Date)
|
||||
{
|
||||
return "'" + sqlServerDateFormat.format(object) + "'";
|
||||
}
|
||||
else if (object instanceof Timestamp)
|
||||
{
|
||||
return "'" + sqlServerTimestampFormat.format(object) + "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.formatParameterObject(object);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/**
|
||||
* Copyright 2007-2009 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.
|
||||
*/
|
||||
package net.sf.log4jdbc;
|
||||
|
||||
/**
|
||||
* Static utility methods for use throughout the project.
|
||||
*/
|
||||
public class Utilities {
|
||||
/**
|
||||
* Right justify a field within a certain number of spaces.
|
||||
* @param fieldSize field size to right justify field within.
|
||||
* @param field contents to right justify within field.
|
||||
* @return the field, right justified within the requested size.
|
||||
*/
|
||||
public static String rightJustify(int fieldSize, String field)
|
||||
{
|
||||
if (field==null)
|
||||
{
|
||||
field="";
|
||||
}
|
||||
StringBuffer output = new StringBuffer();
|
||||
for (int i=0, j = fieldSize-field.length(); i < j; i++)
|
||||
{
|
||||
output.append(' ');
|
||||
}
|
||||
output.append(field);
|
||||
return output.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007-2009 Arthur Blake
|
||||
* Copyright 2007-2015 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -1597,7 +1597,7 @@ public class CallableStatementSpy extends PreparedStatementSpy implements Callab
|
||||
|
||||
public Array getArray(String parameterName) throws SQLException
|
||||
{
|
||||
String methodCall = "getURL(" + parameterName + ")";
|
||||
String methodCall = "getArray(" + parameterName + ")";
|
||||
try
|
||||
{
|
||||
return (Array) reportReturn(methodCall, realCallableStatement.getArray(parameterName));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007-2009 Arthur Blake
|
||||
* Copyright 2007-2015 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