public void sqlOccurred(Spy spy, String methodCall, String sql) { if (!Properties.isDumpSqlFilteringOn() || shouldSqlBeLogged(sql)) { if (sqlOnlyLogger.isDebugEnabled()) { sqlOnlyLogger.debug( getDebugInfo() + nl + spy.getConnectionNumber() + ". " + processSql(sql)); } else if (sqlOnlyLogger.isInfoEnabled()) { sqlOnlyLogger.info(processSql(sql)); } } }
/** * 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 method that generated * the SQL. * @param sql SQL that occurred. */ public void sqlTimingOccurred(Spy spy, long execTime, String methodCall, String sql) { if (sqlTimingLogger.isErrorEnabled() && (!Properties.isDumpSqlFilteringOn() || shouldSqlBeLogged(sql))) { if (Properties.isSqlTimingErrorThresholdEnabled() && execTime >= Properties.getSqlTimingErrorThresholdMsec()) { sqlTimingLogger.error( buildSqlTimingDump(spy, execTime, methodCall, sql, sqlTimingLogger.isDebugEnabled())); } else if (sqlTimingLogger.isWarnEnabled()) { if (Properties.isSqlTimingWarnThresholdEnabled() && execTime >= Properties.getSqlTimingWarnThresholdMsec()) { sqlTimingLogger.warn( buildSqlTimingDump(spy, execTime, methodCall, sql, sqlTimingLogger.isDebugEnabled())); } else if (sqlTimingLogger.isDebugEnabled()) { sqlTimingLogger.debug(buildSqlTimingDump(spy, execTime, methodCall, sql, true)); } else if (sqlTimingLogger.isInfoEnabled()) { sqlTimingLogger.info(buildSqlTimingDump(spy, execTime, methodCall, sql, false)); } } } }