mirror of
https://github.com/encounter/log4jdbc.git
synced 2026-03-30 11:27:21 -07:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ee5468cfe6 | |||
| 88f90f8131 | |||
| 7f7d2f0f3b | |||
| d430b481a4 | |||
| 48154128a9 | |||
| dbc63df301 | |||
| 59ecc4ac8b | |||
| d10afb244f | |||
| c183dc2b5d | |||
| a3ac1c68c1 | |||
| 46c13d8498 | |||
| 6906f31ba5 | |||
| d3a48845f3 |
+19
@@ -1,3 +1,22 @@
|
||||
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
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
log4jdbc is open source software, released under the Apache License, Version 2.0:
|
||||
|
||||
Copyright 2007-2010 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.
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ REM if you don't happen to have it laying around,
|
||||
REM as the ant script properly sets the source
|
||||
REM and target java versions anyway.
|
||||
|
||||
set ANT_HOME=c:\apache-ant-1.8.1
|
||||
set ANT_HOME=c:\apache-ant-1.8.2
|
||||
|
||||
set JAVA_HOME=C:\jdk\1.4.2_19
|
||||
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin
|
||||
@@ -17,7 +17,7 @@ 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_18
|
||||
set JAVA_HOME=C:\jdk\1.6.0_30
|
||||
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin
|
||||
|
||||
call java -version
|
||||
|
||||
+4
-4
@@ -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-2010 Arthur Blake
|
||||
Copyright 2007-2012 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.2beta2"/>
|
||||
<property name="version" value="1.2"/>
|
||||
|
||||
<target name="all" depends="cleancompile,compile,cleanjar,jar"/>
|
||||
|
||||
@@ -159,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/"/>
|
||||
@@ -206,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/"/>
|
||||
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ setlocal
|
||||
REM invoke the 1.4 and the 1.6 jvm each in turn
|
||||
REM for JDBC 3 and JDBC 4 versions respectively
|
||||
|
||||
set ANT_HOME=c:\apache-ant-1.8.1
|
||||
set ANT_HOME=c:\apache-ant-1.8.2
|
||||
set ANT_OPTS=-Xmx512m
|
||||
|
||||
set JAVA_HOME=C:\jdk\1.4.2_19
|
||||
@@ -13,7 +13,7 @@ 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_18
|
||||
set JAVA_HOME=c:\jdk\1.6.0_30
|
||||
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin
|
||||
|
||||
call java -version
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
rem *************************************************************************************************
|
||||
rem * *
|
||||
rem * Copyright 2007-2010 Arthur Blake *
|
||||
rem * Copyright 2007-2012 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.2beta2.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-2010 Arthur Blake *
|
||||
# * Copyright 2007-2012 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.2beta2.jar net.sf.log4jdbc.PostLogProfilerProcessor $@
|
||||
java -Xmx1024m -classpath ../build/log4jdbc3-1.2.jar net.sf.log4jdbc.PostLogProfilerProcessor $@
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007-2010 Arthur Blake
|
||||
* Copyright 2007-2012 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-2010 Arthur Blake
|
||||
* Copyright 2007-2012 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-2010 Arthur Blake
|
||||
* Copyright 2007-2012 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,9 +35,9 @@ 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, by default, 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
|
||||
* used by any other JDBC driver. The driver, by default, 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.
|
||||
* <p/>
|
||||
* The well known driver classes that are loaded are:
|
||||
@@ -197,7 +197,7 @@ public class DriverSpy implements Driver
|
||||
* under some circumstances.
|
||||
*/
|
||||
static boolean DumpFullDebugStackTrace;
|
||||
|
||||
|
||||
/**
|
||||
* Attempt to Automatically load a set of popular JDBC drivers?
|
||||
*/
|
||||
@@ -208,6 +208,13 @@ public class DriverSpy implements Driver
|
||||
*/
|
||||
static boolean TrimSql;
|
||||
|
||||
/**
|
||||
* Remove extra Lines in the SQL that consist of only white space?
|
||||
* Only when 2 or more lines in a row like this occur, will the extra lines (beyond 1)
|
||||
* be removed.
|
||||
*/
|
||||
static boolean TrimExtraBlankLinesInSql;
|
||||
|
||||
/**
|
||||
* Coldfusion typically calls PreparedStatement.getGeneratedKeys() after
|
||||
* every SQL update call, even if it's not warranted. This typically produces
|
||||
@@ -253,21 +260,21 @@ public class DriverSpy implements Driver
|
||||
/**
|
||||
* Get a Long option from a property and
|
||||
* log a debug message about this.
|
||||
*
|
||||
*
|
||||
* @param props Properties to get option from.
|
||||
* @param propName property key.
|
||||
*
|
||||
* @return the value of that property key, converted
|
||||
* to a Long. Or null if not defined or is invalid.
|
||||
*/
|
||||
private static Long getLongOption(Properties props, String propName,
|
||||
private static Long getLongOption(Properties props, String propName,
|
||||
long defaultValue)
|
||||
{
|
||||
String propValue = props.getProperty(propName);
|
||||
Long longPropValue;
|
||||
if (propValue == null)
|
||||
{
|
||||
log.debug("x " + propName + " is not defined (using default of " +
|
||||
log.debug("x " + propName + " is not defined (using default of " +
|
||||
defaultValue +")");
|
||||
longPropValue = new Long(defaultValue);
|
||||
}
|
||||
@@ -314,7 +321,7 @@ public class DriverSpy implements Driver
|
||||
/**
|
||||
* Get a boolean option from a property and
|
||||
* log a debug message about this.
|
||||
*
|
||||
*
|
||||
* @param props Properties to get option from.
|
||||
* @param propName property name to get.
|
||||
* @param defaultValue default value to use if undefined.
|
||||
@@ -354,9 +361,9 @@ public class DriverSpy implements Driver
|
||||
{
|
||||
log.debug("... log4jdbc initializing ...");
|
||||
|
||||
InputStream propStream =
|
||||
InputStream propStream =
|
||||
DriverSpy.class.getResourceAsStream("/log4jdbc.properties");
|
||||
|
||||
|
||||
Properties props = new Properties(System.getProperties());
|
||||
if (propStream != null)
|
||||
{
|
||||
@@ -377,9 +384,9 @@ public class DriverSpy implements Driver
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.debug("ERROR! io exception closing property file stream: " +
|
||||
log.debug("ERROR! io exception closing property file stream: " +
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
log.debug(" log4jdbc.properties loaded from classpath");
|
||||
}
|
||||
@@ -409,7 +416,7 @@ public class DriverSpy implements Driver
|
||||
DumpBooleanAsTrueFalse =
|
||||
getBooleanOption(props, "log4jdbc.dump.booleanastruefalse",false);
|
||||
|
||||
DumpSqlMaxLineLength = getLongOption(props,
|
||||
DumpSqlMaxLineLength = getLongOption(props,
|
||||
"log4jdbc.dump.sql.maxlinelength", 90L).intValue();
|
||||
|
||||
DumpFullDebugStackTrace =
|
||||
@@ -435,8 +442,10 @@ public class DriverSpy implements Driver
|
||||
|
||||
TrimSql = getBooleanOption(props, "log4jdbc.trim.sql", true);
|
||||
|
||||
SuppressGetGeneratedKeysException =
|
||||
getBooleanOption(props, "log4jdbc.suppress.generated.keys.exception",
|
||||
TrimExtraBlankLinesInSql = getBooleanOption(props, "log4jdbc.trim.sql.extrablanklines", true);
|
||||
|
||||
SuppressGetGeneratedKeysException =
|
||||
getBooleanOption(props, "log4jdbc.suppress.generated.keys.exception",
|
||||
false);
|
||||
|
||||
// The Set of drivers that the log4jdbc driver will preload at instantiation
|
||||
@@ -519,6 +528,7 @@ public class DriverSpy implements Driver
|
||||
|
||||
SqlServerRdbmsSpecifics sqlServer = new SqlServerRdbmsSpecifics();
|
||||
OracleRdbmsSpecifics oracle = new OracleRdbmsSpecifics();
|
||||
MySqlRdbmsSpecifics mySql = new MySqlRdbmsSpecifics();
|
||||
|
||||
/** create lookup Map for specific rdbms formatters */
|
||||
rdbmsSpecifics = new HashMap();
|
||||
@@ -528,7 +538,8 @@ public class DriverSpy implements Driver
|
||||
rdbmsSpecifics.put("com.microsoft.jdbc.sqlserver.SQLServerDriver",
|
||||
sqlServer);
|
||||
rdbmsSpecifics.put("weblogic.jdbc.sqlserver.SQLServerDriver", sqlServer);
|
||||
|
||||
rdbmsSpecifics.put("com.mysql.jdbc.Driver", mySql);
|
||||
|
||||
log.debug("... log4jdbc initialized! ...");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Copyright 2007-2012 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.text.SimpleDateFormat;
|
||||
|
||||
/**
|
||||
* RDBMS specifics for the MySql db.
|
||||
*
|
||||
* @author Arthur Blake
|
||||
*/
|
||||
class MySqlRdbmsSpecifics extends RdbmsSpecifics
|
||||
{
|
||||
MySqlRdbmsSpecifics()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
String formatParameterObject(Object object)
|
||||
{
|
||||
if (object instanceof java.sql.Time)
|
||||
{
|
||||
return "'" + new SimpleDateFormat("HH:mm:ss").format(object) + "'";
|
||||
}
|
||||
else if (object instanceof java.sql.Date)
|
||||
{
|
||||
return "'" + new SimpleDateFormat("yyyy-MM-dd").format(object) + "'";
|
||||
}
|
||||
else if (object instanceof java.util.Date) // (includes java.sql.Timestamp)
|
||||
{
|
||||
return "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(object) + "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.formatParameterObject(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007-2010 Arthur Blake
|
||||
* Copyright 2007-2012 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-2010 Arthur Blake
|
||||
* Copyright 2007-2012 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-2010 Arthur Blake
|
||||
* Copyright 2007-2012 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-2010 Arthur Blake
|
||||
* Copyright 2007-2012 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,6 @@
|
||||
package net.sf.log4jdbc;
|
||||
|
||||
import java.util.Date;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
/**
|
||||
@@ -55,8 +54,7 @@ class RdbmsSpecifics
|
||||
{
|
||||
if (object instanceof String)
|
||||
{
|
||||
// todo: need to handle imbedded quotes??
|
||||
return "'" + object + "'";
|
||||
return "'" + escapeString((String)object) + "'";
|
||||
}
|
||||
else if (object instanceof Date)
|
||||
{
|
||||
@@ -75,4 +73,26 @@ class RdbmsSpecifics
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure string is escaped properly so that it will run in a SQL query analyzer tool.
|
||||
* At this time all we do is double any single tick marks.
|
||||
* Do not call this with a null string or else an exception will occur.
|
||||
*
|
||||
* @return the input String, escaped.
|
||||
*/
|
||||
String escapeString(String in)
|
||||
{
|
||||
StringBuffer out = new StringBuffer();
|
||||
for (int i=0, j=in.length(); i < j; i++)
|
||||
{
|
||||
char c = in.charAt(i);
|
||||
if (c == '\'')
|
||||
{
|
||||
out.append(c);
|
||||
}
|
||||
out.append(c);
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007-2010 Arthur Blake
|
||||
* Copyright 2007-2012 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -1335,16 +1335,7 @@ public class ResultSetSpy implements ResultSet, Spy
|
||||
String methodCall = "getStatement()";
|
||||
try
|
||||
{
|
||||
Statement s = realResultSet.getStatement();
|
||||
if (s == null)
|
||||
{
|
||||
return (Statement) reportReturn(methodCall, s);
|
||||
}
|
||||
else
|
||||
{
|
||||
//todo: what's going on here?
|
||||
return (Statement) reportReturn(methodCall, new StatementSpy(new ConnectionSpy(s.getConnection()), s));
|
||||
}
|
||||
return (Statement) reportReturn(methodCall, realResultSet.getStatement());
|
||||
}
|
||||
catch (SQLException s)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007-2010 Arthur Blake
|
||||
* Copyright 2007-2012 Arthur Blake
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,10 +15,11 @@
|
||||
*/
|
||||
package net.sf.log4jdbc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.LineNumberReader;
|
||||
import java.io.StringReader;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.sf.log4jdbc.DriverSpy;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -106,6 +107,7 @@ public class Slf4jSpyLogDelegator implements SpyLogDelegator
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = processSql(sql);
|
||||
jdbcLogger.error(header + " " + sql, e);
|
||||
|
||||
// if at debug level, display debug info to error log
|
||||
@@ -129,14 +131,14 @@ public class Slf4jSpyLogDelegator implements SpyLogDelegator
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when a JDBC method from a Connection, Statement, PreparedStatement,
|
||||
* CallableStatement or ResultSet returns.
|
||||
*
|
||||
* @param spy the Spy wrapping the class that called the method that
|
||||
* @param spy the Spy wrapping the class that called the method that
|
||||
* returned.
|
||||
* @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 returned.
|
||||
* @param returnMsg return value converted to a String for integral types, or
|
||||
* String representation for Object. Return types this will
|
||||
@@ -149,7 +151,7 @@ public class Slf4jSpyLogDelegator implements SpyLogDelegator
|
||||
resultSetLogger:jdbcLogger;
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
String header = spy.getConnectionNumber() + ". " + classType + "." +
|
||||
String header = spy.getConnectionNumber() + ". " + classType + "." +
|
||||
methodCall + " returned " + returnMsg;
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
@@ -214,15 +216,14 @@ public class Slf4jSpyLogDelegator implements SpyLogDelegator
|
||||
{
|
||||
if (!DriverSpy.DumpSqlFilteringOn || shouldSqlBeLogged(sql))
|
||||
{
|
||||
sql = processSql(sql);
|
||||
|
||||
if (sqlOnlyLogger.isDebugEnabled())
|
||||
{
|
||||
sqlOnlyLogger.debug(getDebugInfo() + nl + spy.getConnectionNumber() + ". " + sql);
|
||||
sqlOnlyLogger.debug(getDebugInfo() + nl + spy.getConnectionNumber() +
|
||||
". " + processSql(sql));
|
||||
}
|
||||
else if (sqlOnlyLogger.isInfoEnabled())
|
||||
{
|
||||
sqlOnlyLogger.info(sql);
|
||||
sqlOnlyLogger.info(processSql(sql));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -280,7 +281,52 @@ public class Slf4jSpyLogDelegator implements SpyLogDelegator
|
||||
output.append(";");
|
||||
}
|
||||
|
||||
return output.toString();
|
||||
String stringOutput = output.toString();
|
||||
|
||||
if (DriverSpy.TrimExtraBlankLinesInSql)
|
||||
{
|
||||
LineNumberReader lineReader = new LineNumberReader(new StringReader(stringOutput));
|
||||
|
||||
output = new StringBuffer();
|
||||
|
||||
int contiguousBlankLines = 0;
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
String line = lineReader.readLine();
|
||||
if (line==null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// is this line blank?
|
||||
if (line.trim().length() == 0)
|
||||
{
|
||||
contiguousBlankLines ++;
|
||||
// skip contiguous blank lines
|
||||
if (contiguousBlankLines > 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
contiguousBlankLines = 0;
|
||||
output.append(line);
|
||||
}
|
||||
output.append("\n");
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// since we are reading from a buffer, this isn't likely to happen,
|
||||
// but if it does we just ignore it and treat it like its the end of the stream
|
||||
}
|
||||
stringOutput = output.toString();
|
||||
}
|
||||
|
||||
return stringOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -304,7 +350,7 @@ public class Slf4jSpyLogDelegator implements SpyLogDelegator
|
||||
execTime >= DriverSpy.SqlTimingErrorThresholdMsec)
|
||||
{
|
||||
sqlTimingLogger.error(
|
||||
buildSqlTimingDump(spy, execTime, methodCall, sql, true));
|
||||
buildSqlTimingDump(spy, execTime, methodCall, sql, sqlTimingLogger.isDebugEnabled()));
|
||||
}
|
||||
else if (sqlTimingLogger.isWarnEnabled())
|
||||
{
|
||||
@@ -312,7 +358,7 @@ public class Slf4jSpyLogDelegator implements SpyLogDelegator
|
||||
execTime >= DriverSpy.SqlTimingWarnThresholdMsec)
|
||||
{
|
||||
sqlTimingLogger.warn(
|
||||
buildSqlTimingDump(spy, execTime, methodCall, sql, true));
|
||||
buildSqlTimingDump(spy, execTime, methodCall, sql, sqlTimingLogger.isDebugEnabled()));
|
||||
}
|
||||
else if (sqlTimingLogger.isDebugEnabled())
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2007-2010 Arthur Blake
|
||||
* Copyright 2007-2012 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-2010 Arthur Blake
|
||||
* Copyright 2007-2012 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-2010 Arthur Blake
|
||||
* Copyright 2007-2012 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