diff --git a/jOOQ/src/main/java/org/jooq/Log.java b/jOOQ/src/main/java/org/jooq/Log.java index 6860af74a6..196a5ec684 100644 --- a/jOOQ/src/main/java/org/jooq/Log.java +++ b/jOOQ/src/main/java/org/jooq/Log.java @@ -161,6 +161,11 @@ public interface Log { */ void info(Object message, Object details, Throwable throwable); + /** + * Check if WARN level logging is enabled. + */ + boolean isWarnEnabled(); + /** * Log a message in WARN level. * @@ -195,6 +200,11 @@ public interface Log { */ void warn(Object message, Object details, Throwable throwable); + /** + * Check if ERROR level logging is enabled. + */ + boolean isErrorEnabled(); + /** * Log a message in ERROR level. * @@ -229,6 +239,84 @@ public interface Log { */ void error(Object message, Object details, Throwable throwable); + default boolean isEnabled(final Log.Level level) { + switch (level) { + case TRACE: return isTraceEnabled(); + case DEBUG: return isDebugEnabled(); + case INFO: return isInfoEnabled(); + case WARN: return isWarnEnabled(); + case ERROR: return isErrorEnabled(); + case FATAL: return isErrorEnabled(); + default: return false; + } + } + + default void log(final Object message, final Log.Level level) { + log(message, (Object) null, level); + } + + default void log(final Object message, final Object details, final Log.Level level) { + switch (level) { + case TRACE: { + trace(message, details); + return; + } + case DEBUG: { + debug(message, details); + return; + } + case INFO: { + info(message, details); + return; + } + case WARN: { + warn(message, details); + return; + } + case ERROR: { + error(message, details); + return; + } + case FATAL: { + error(message, details); + return; + } + } + } + + default void log(final Object message, final Throwable throwable, final Log.Level level) { + log(message, null, throwable, level); + } + + default void log(final Object message, final Object details, final Throwable throwable, final Log.Level level) { + switch (level) { + case TRACE: { + trace(message, details, throwable); + return; + } + case DEBUG: { + debug(message, details, throwable); + return; + } + case INFO: { + info(message, details, throwable); + return; + } + case WARN: { + warn(message, details, throwable); + return; + } + case ERROR: { + error(message, details, throwable); + return; + } + case FATAL: { + error(message, details, throwable); + return; + } + } + } + /** * The log level. */ diff --git a/jOOQ/src/main/java/org/jooq/conf/Settings.java b/jOOQ/src/main/java/org/jooq/conf/Settings.java index 3c34e07de0..3bac3f9e36 100644 --- a/jOOQ/src/main/java/org/jooq/conf/Settings.java +++ b/jOOQ/src/main/java/org/jooq/conf/Settings.java @@ -8,6 +8,8 @@ package org.jooq.conf; +import org.jooq.Log; + import java.io.Serializable; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -65,6 +67,22 @@ public class Settings protected StatementType statementType = StatementType.PREPARED_STATEMENT; @XmlElement(defaultValue = "true") protected Boolean executeLogging = true; + @XmlElement(defaultValue = "DEBUG") + protected Log.Level executeLoggingBindVariables = Log.Level.DEBUG; + @XmlElement(defaultValue = "false") + protected Boolean executeLoggingAbbreviatedBindVariables = false; + @XmlElement(defaultValue = "DEBUG") + protected Log.Level executeLoggingSqlString = Log.Level.DEBUG; + @XmlElement(defaultValue = "DEBUG") + protected Log.Level executeLoggingResult = Log.Level.DEBUG; + @XmlElement(defaultValue = "5") + protected Integer executeLoggingResultNumberOfRows = 5; + @XmlElement(defaultValue = "50") + protected Integer executeLoggingResultNumberOfColumns = 50; + @XmlElement(defaultValue = "DEBUG") + protected Log.Level executeLoggingRoutine = Log.Level.DEBUG; + @XmlElement(defaultValue = "DEBUG") + protected Log.Level executeLoggingException = Log.Level.DEBUG; @XmlElement(defaultValue = "false") protected Boolean executeWithOptimisticLocking = false; @XmlElement(defaultValue = "false") @@ -453,6 +471,70 @@ public class Settings this.executeLogging = value; } + public Log.Level getExecuteLoggingBindVariables() { + return executeLoggingBindVariables; + } + + public void setExecuteLoggingBindVariables(final Log.Level executeLoggingBindVariables) { + this.executeLoggingBindVariables = executeLoggingBindVariables; + } + + public Boolean isExecuteLoggingAbbreviatedBindVariables() { + return executeLoggingAbbreviatedBindVariables; + } + + public void setExecuteLoggingAbbreviatedBindVariables(final Boolean executeLoggingAbbreviatedBindVariables) { + this.executeLoggingAbbreviatedBindVariables = executeLoggingAbbreviatedBindVariables; + } + + public Log.Level getExecuteLoggingSqlString() { + return executeLoggingSqlString; + } + + public void setExecuteLoggingSqlString(final Log.Level executeLoggingSqlString) { + this.executeLoggingSqlString = executeLoggingSqlString; + } + + public Log.Level getExecuteLoggingResult() { + return executeLoggingResult; + } + + public void setExecuteLoggingResult(final Log.Level executeLoggingResult) { + this.executeLoggingResult = executeLoggingResult; + } + + public Integer getExecuteLoggingResultNumberOfRows() { + return executeLoggingResultNumberOfRows; + } + + public void setExecuteLoggingResultNumberOfRows(final Integer executeLoggingResultNumberOfRows) { + this.executeLoggingResultNumberOfRows = executeLoggingResultNumberOfRows; + } + + public Integer getExecuteLoggingResultNumberOfColumns() { + return executeLoggingResultNumberOfColumns; + } + + public void setExecuteLoggingResultNumberOfColumns(final Integer executeLoggingResultNumberOfColumns) { + this.executeLoggingResultNumberOfColumns = executeLoggingResultNumberOfColumns; + } + + public Log.Level getExecuteLoggingRoutine() { + return executeLoggingRoutine; + } + + public void setExecuteLoggingRoutine(final Log.Level executeLoggingRoutine) { + this.executeLoggingRoutine = executeLoggingRoutine; + } + + public Log.Level getExecuteLoggingException() { + return executeLoggingException; + } + + public void setExecuteLoggingException(final Log.Level executeLoggingException) { + this.executeLoggingException = executeLoggingException; + } + /** * Whether store() and delete() methods should be executed with optimistic locking. * @@ -1084,6 +1166,55 @@ public class Settings return this; } + public Settings withExecuteLoggingBindVariables(Log.Level value) { + setExecuteLoggingBindVariables(value); + return this; + } + + public Settings withExecuteLoggingAbbreviatedBindVariables(Boolean value) { + setExecuteLoggingAbbreviatedBindVariables(value); + return this; + } + + public Settings withExecuteLoggingSqlString(Log.Level value) { + setExecuteLoggingSqlString(value); + return this; + } + + public Settings withExecuteLoggingResult(Log.Level value) { + setExecuteLoggingResult(value); + return this; + } + + public Settings withExecuteLoggingResultNumberOfRows(Integer value) { + setExecuteLoggingResultNumberOfRows(value); + return this; + } + + public Settings withExecuteLoggingResultNumberOfColumns(Integer value) { + setExecuteLoggingResultNumberOfColumns(value); + return this; + } + + public Settings withExecuteLoggingRoutine(Log.Level value) { + setExecuteLoggingRoutine(value); + return this; + } + + public Settings withExecuteLoggingException(Log.Level value) { + setExecuteLoggingException(value); + return this; + } + + public Settings withExecuteLoggingOverallLevel(Log.Level value) { + setExecuteLoggingBindVariables(value); + setExecuteLoggingSqlString(value); + setExecuteLoggingResult(value); + setExecuteLoggingRoutine(value); + setExecuteLoggingException(value); + return this; + } + public Settings withExecuteWithOptimisticLocking(Boolean value) { setExecuteWithOptimisticLocking(value); return this; @@ -1267,6 +1398,46 @@ public class Settings sb.append(executeLogging); sb.append(""); } + if (executeLoggingBindVariables!= null) { + sb.append(""); + sb.append(executeLoggingBindVariables); + sb.append(""); + } + if (executeLoggingAbbreviatedBindVariables!= null) { + sb.append(""); + sb.append(executeLoggingAbbreviatedBindVariables); + sb.append(""); + } + if (executeLoggingSqlString!= null) { + sb.append(""); + sb.append(executeLoggingSqlString); + sb.append(""); + } + if (executeLoggingResult!= null) { + sb.append(""); + sb.append(executeLoggingResult); + sb.append(""); + } + if (executeLoggingResultNumberOfRows!= null) { + sb.append(""); + sb.append(executeLoggingResultNumberOfRows); + sb.append(""); + } + if (executeLoggingResultNumberOfColumns!= null) { + sb.append(""); + sb.append(executeLoggingResultNumberOfColumns); + sb.append(""); + } + if (executeLoggingRoutine!= null) { + sb.append(""); + sb.append(executeLoggingRoutine); + sb.append(""); + } + if (executeLoggingException!= null) { + sb.append(""); + sb.append(executeLoggingException); + sb.append(""); + } if (executeWithOptimisticLocking!= null) { sb.append(""); sb.append(executeWithOptimisticLocking); @@ -1514,6 +1685,78 @@ public class Settings return false; } } + if (executeLoggingBindVariables == null) { + if (other.executeLoggingBindVariables!= null) { + return false; + } + } else { + if (!executeLoggingBindVariables.equals(other.executeLoggingBindVariables)) { + return false; + } + } + if (executeLoggingAbbreviatedBindVariables == null) { + if (other.executeLoggingAbbreviatedBindVariables!= null) { + return false; + } + } else { + if (!executeLoggingAbbreviatedBindVariables.equals(other.executeLoggingAbbreviatedBindVariables)) { + return false; + } + } + if (executeLoggingSqlString == null) { + if (other.executeLoggingSqlString!= null) { + return false; + } + } else { + if (!executeLoggingSqlString.equals(other.executeLoggingSqlString)) { + return false; + } + } + if (executeLoggingResult == null) { + if (other.executeLoggingResult!= null) { + return false; + } + } else { + if (!executeLoggingResult.equals(other.executeLoggingResult)) { + return false; + } + } + if (executeLoggingResultNumberOfRows == null) { + if (other.executeLoggingResultNumberOfRows!= null) { + return false; + } + } else { + if (!executeLoggingResultNumberOfRows.equals(other.executeLoggingResultNumberOfRows)) { + return false; + } + } + if (executeLoggingResultNumberOfColumns == null) { + if (other.executeLoggingResultNumberOfColumns!= null) { + return false; + } + } else { + if (!executeLoggingResultNumberOfColumns.equals(other.executeLoggingResultNumberOfColumns)) { + return false; + } + } + if (executeLoggingRoutine == null) { + if (other.executeLoggingRoutine!= null) { + return false; + } + } else { + if (!executeLoggingRoutine.equals(other.executeLoggingRoutine)) { + return false; + } + } + if (executeLoggingException == null) { + if (other.executeLoggingException!= null) { + return false; + } + } else { + if (!executeLoggingException.equals(other.executeLoggingException)) { + return false; + } + } if (executeWithOptimisticLocking == null) { if (other.executeWithOptimisticLocking!= null) { return false; @@ -1741,6 +1984,14 @@ public class Settings result = ((prime*result)+((paramCastMode == null)? 0 :paramCastMode.hashCode())); result = ((prime*result)+((statementType == null)? 0 :statementType.hashCode())); result = ((prime*result)+((executeLogging == null)? 0 :executeLogging.hashCode())); + result = ((prime*result)+((executeLoggingBindVariables == null)? 0 :executeLoggingBindVariables.hashCode())); + result = ((prime*result)+((executeLoggingAbbreviatedBindVariables == null)? 0 :executeLoggingAbbreviatedBindVariables.hashCode())); + result = ((prime*result)+((executeLoggingSqlString == null)? 0 :executeLoggingSqlString.hashCode())); + result = ((prime*result)+((executeLoggingResult == null)? 0 :executeLoggingResult.hashCode())); + result = ((prime*result)+((executeLoggingResultNumberOfRows == null)? 0 :executeLoggingResultNumberOfRows.hashCode())); + result = ((prime*result)+((executeLoggingResultNumberOfColumns == null)? 0 :executeLoggingResultNumberOfColumns.hashCode())); + result = ((prime*result)+((executeLoggingRoutine == null)? 0 :executeLoggingRoutine.hashCode())); + result = ((prime*result)+((executeLoggingException == null)? 0 :executeLoggingException.hashCode())); result = ((prime*result)+((executeWithOptimisticLocking == null)? 0 :executeWithOptimisticLocking.hashCode())); result = ((prime*result)+((executeWithOptimisticLockingExcludeUnversioned == null)? 0 :executeWithOptimisticLockingExcludeUnversioned.hashCode())); result = ((prime*result)+((attachRecords == null)? 0 :attachRecords.hashCode())); diff --git a/jOOQ/src/main/java/org/jooq/impl/ExecuteListeners.java b/jOOQ/src/main/java/org/jooq/impl/ExecuteListeners.java index 68224cddaf..416f60bd4d 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ExecuteListeners.java +++ b/jOOQ/src/main/java/org/jooq/impl/ExecuteListeners.java @@ -102,7 +102,15 @@ final class ExecuteListeners implements ExecuteListener { // [#6747] Avoid allocating the listener (and by consequence, the ExecuteListeners) if // we do not DEBUG log anyway. if (LOGGER_LISTENER_LOGGER.isDebugEnabled()) - (result = init(result)).add(new LoggerListener()); + (result = init(result)).add(new LoggerListener( + ctx.settings().getExecuteLoggingBindVariables(), + ctx.settings().isExecuteLoggingAbbreviatedBindVariables(), + ctx.settings().getExecuteLoggingSqlString(), + ctx.settings().getExecuteLoggingResult(), + ctx.settings().getExecuteLoggingResultNumberOfRows(), + ctx.settings().getExecuteLoggingResultNumberOfColumns(), + ctx.settings().getExecuteLoggingRoutine(), + ctx.settings().getExecuteLoggingException())); } for (ExecuteListenerProvider provider : ctx.configuration().executeListenerProviders()) diff --git a/jOOQ/src/main/java/org/jooq/tools/JooqLogger.java b/jOOQ/src/main/java/org/jooq/tools/JooqLogger.java index 8071e9ba73..7a077054c7 100644 --- a/jOOQ/src/main/java/org/jooq/tools/JooqLogger.java +++ b/jOOQ/src/main/java/org/jooq/tools/JooqLogger.java @@ -37,6 +37,7 @@ */ package org.jooq.tools; +import org.apache.log4j.Priority; import org.jooq.Log; /** @@ -92,6 +93,16 @@ public final class JooqLogger implements Log { */ private boolean supportsInfo = true; + /** + * Whether calls to {@link #warn(Object)} are possible. + */ + private boolean supportsWarn = true; + + /** + * Whether calls to {@link #error(Object)} are possible. + */ + private boolean supportsError = true; + /** * Get a logger wrapper for a class. */ @@ -119,6 +130,20 @@ public final class JooqLogger implements Log { // unavailable, e.g. because client code isn't using the latest version // of log4j or any other logger + try { + result.isErrorEnabled(); + } + catch (Throwable e) { + result.supportsError = false; + } + + try { + result.isWarnEnabled(); + } + catch (Throwable e) { + result.supportsWarn = false; + } + try { result.isInfoEnabled(); } @@ -374,6 +399,23 @@ public final class JooqLogger implements Log { util.log(java.util.logging.Level.INFO, "" + getMessage(message, details), throwable); } + /** + * Check if WARN level logging is enabled. + */ + @Override + public boolean isWarnEnabled() { + if (!globalThreshold.supports(Log.Level.WARN)) + return false; + if (!supportsWarn) + return false; + else if (slf4j != null) + return slf4j.isWarnEnabled(); + else if (log4j != null) + return log4j.isEnabledFor(Priority.WARN); + else + return util.isLoggable(java.util.logging.Level.WARNING); + } + /** * Log a message in WARN level. * @@ -434,6 +476,23 @@ public final class JooqLogger implements Log { util.log(java.util.logging.Level.WARNING, "" + getMessage(message, details), throwable); } + /** + * Check if ERROR level logging is enabled. + */ + @Override + public boolean isErrorEnabled() { + if (!globalThreshold.supports(Log.Level.ERROR)) + return false; + if (!supportsError) + return false; + else if (slf4j != null) + return slf4j.isErrorEnabled(); + else if (log4j != null) + return log4j.isEnabledFor(Priority.ERROR); + else + return util.isLoggable(java.util.logging.Level.SEVERE); + } + /** * Log a message in ERROR level. * diff --git a/jOOQ/src/main/java/org/jooq/tools/LoggerListener.java b/jOOQ/src/main/java/org/jooq/tools/LoggerListener.java index c7845132bc..52edeac14f 100644 --- a/jOOQ/src/main/java/org/jooq/tools/LoggerListener.java +++ b/jOOQ/src/main/java/org/jooq/tools/LoggerListener.java @@ -38,6 +38,7 @@ package org.jooq.tools; import static java.lang.Boolean.TRUE; +import static java.util.Objects.requireNonNull; import static org.jooq.impl.DSL.field; import static org.jooq.impl.DSL.name; import static org.jooq.impl.DSL.val; @@ -53,6 +54,7 @@ import org.jooq.ExecuteContext; import org.jooq.ExecuteListener; import org.jooq.ExecuteType; import org.jooq.Field; +import org.jooq.Log; import org.jooq.Param; import org.jooq.Parameter; import org.jooq.QueryPart; @@ -82,91 +84,121 @@ public class LoggerListener extends DefaultExecuteListener { private static final JooqLogger log = JooqLogger.getLogger(LoggerListener.class); + private final Log.Level executeLoggingBindVariables; + + private final boolean executeLoggingAbbreviatedBindVariables; + + private final Log.Level executeLoggingSqlString; + + private final Log.Level executeLoggingResult; + + private final int executeLoggingResultNumberOfRows; + + private final int executeLoggingResultNumberOfColumns; + + private final Log.Level executeLoggingRoutine; + + private final Log.Level executeLoggingException; + + public LoggerListener(final Log.Level executeLoggingBindVariables, + final Boolean executeLoggingAbbreviatedBindVariables, + final Log.Level executeLoggingSqlString, + final Log.Level executeLoggingResult, + final Integer executeLoggingResultNumberOfRows, + final Integer executeLoggingResultNumberOfColumns, + final Log.Level executeLoggingRoutine, + final Log.Level executeLoggingException) { + this.executeLoggingBindVariables = requireNonNull(executeLoggingBindVariables); + this.executeLoggingAbbreviatedBindVariables = requireNonNull(executeLoggingAbbreviatedBindVariables); + this.executeLoggingSqlString = requireNonNull(executeLoggingSqlString); + this.executeLoggingResult = requireNonNull(executeLoggingResult); + this.executeLoggingResultNumberOfRows = requireNonNull(executeLoggingResultNumberOfRows); + this.executeLoggingResultNumberOfColumns = requireNonNull(executeLoggingResultNumberOfColumns); + this.executeLoggingRoutine = requireNonNull(executeLoggingRoutine); + this.executeLoggingException = requireNonNull(executeLoggingException); + } + @Override public void renderEnd(ExecuteContext ctx) { - if (log.isDebugEnabled()) { - Configuration configuration = ctx.configuration(); - String newline = TRUE.equals(configuration.settings().isRenderFormatted()) ? "\n" : ""; + Configuration configuration = ctx.configuration(); + String newline = TRUE.equals(configuration.settings().isRenderFormatted()) ? "\n" : ""; - // [#2939] Prevent excessive logging of bind variables only in DEBUG mode, not in TRACE mode. - if (!log.isTraceEnabled()) - configuration = abbreviateBindVariables(configuration); + // [#2939] Prevent excessive logging of bind variables only in DEBUG mode, not in TRACE mode. + if (executeLoggingAbbreviatedBindVariables) + configuration = abbreviateBindVariables(configuration); - String[] batchSQL = ctx.batchSQL(); - if (ctx.query() != null) { + String[] batchSQL = ctx.batchSQL(); + if (log.isEnabled(executeLoggingSqlString) && ctx.query() != null) { - // Actual SQL passed to JDBC - log.debug("Executing query", newline + ctx.sql()); + // Actual SQL passed to JDBC + log.log("Executing query", newline + ctx.sql(), executeLoggingSqlString); - // [#1278] DEBUG log also SQL with inlined bind values, if - // that is not the same as the actual SQL passed to JDBC + // [#1278] DEBUG log also SQL with inlined bind values, if + // that is not the same as the actual SQL passed to JDBC + if (log.isEnabled(executeLoggingBindVariables)) { String inlined = DSL.using(configuration).renderInlined(ctx.query()); if (!ctx.sql().equals(inlined)) - log.debug("-> with bind values", newline + inlined); + log.log("-> with bind values", newline + inlined, executeLoggingBindVariables); } + } - // [#2987] Log routines - else if (ctx.routine() != null) { - log.debug("Calling routine", newline + ctx.sql()); + // [#2987] Log routines + else if (log.isEnabled(executeLoggingRoutine) && ctx.routine() != null) { + log.log("Calling routine", newline + ctx.sql(), executeLoggingRoutine); + + if (log.isEnabled(executeLoggingBindVariables)) { String inlined = DSL.using(configuration) - .renderInlined(ctx.routine()); + .renderInlined(ctx.routine()); if (!ctx.sql().equals(inlined)) - log.debug("-> with bind values", newline + inlined); + log.log("-> with bind values", newline + inlined, executeLoggingBindVariables); } + } else if (log.isEnabled(executeLoggingSqlString) && !StringUtils.isBlank(ctx.sql())) { - else if (!StringUtils.isBlank(ctx.sql())) { + // [#1529] Batch queries should be logged specially + if (ctx.type() == ExecuteType.BATCH) + log.log("Executing batch query", newline + ctx.sql(), executeLoggingSqlString); + else + log.log("Executing query", newline + ctx.sql(), executeLoggingSqlString); + } - // [#1529] Batch queries should be logged specially - if (ctx.type() == ExecuteType.BATCH) - log.debug("Executing batch query", newline + ctx.sql()); - else - log.debug("Executing query", newline + ctx.sql()); - } - - // [#2532] Log a complete BatchMultiple query - else if (batchSQL.length > 0) { - if (batchSQL[batchSQL.length - 1] != null) - for (String sql : batchSQL) - log.debug("Executing batch query", newline + sql); - } + // [#2532] Log a complete BatchMultiple query + else if (log.isEnabled(executeLoggingSqlString) && batchSQL.length > 0) { + if (batchSQL[batchSQL.length - 1] != null) + for (String sql : batchSQL) + log.log("Executing batch query", newline + sql, executeLoggingSqlString); } } @Override public void recordEnd(ExecuteContext ctx) { - if (log.isTraceEnabled() && ctx.record() != null) - logMultiline("Record fetched", ctx.record().toString(), Level.FINER); + if (log.isEnabled(executeLoggingResult) && ctx.record() != null) + logMultiline("Record fetched", ctx.record().toString(), executeLoggingResult); } @Override public void resultEnd(ExecuteContext ctx) { - if (ctx.result() != null) - if (log.isTraceEnabled()) - logMultiline("Fetched result", ctx.result().format(TXTFormat.DEFAULT.maxRows(500).maxColWidth(500)), Level.FINE); - else if (log.isDebugEnabled()) - logMultiline("Fetched result", ctx.result().format(TXTFormat.DEFAULT.maxRows(5).maxColWidth(50)), Level.FINE); + if (log.isEnabled(executeLoggingResult) && ctx.result() != null) + logMultiline("Fetched result", ctx.result().format(TXTFormat.DEFAULT.maxRows(executeLoggingResultNumberOfRows).maxColWidth(executeLoggingResultNumberOfColumns)), executeLoggingResult); } @Override public void executeEnd(ExecuteContext ctx) { - if (ctx.rows() >= 0) - if (log.isDebugEnabled()) - log.debug("Affected row(s)", ctx.rows()); + if (log.isEnabled(executeLoggingResult) && ctx.rows() >= 0) + log.log("Affected row(s)", ctx.rows(), executeLoggingResult); } @Override public void outEnd(ExecuteContext ctx) { - if (ctx.routine() != null) - if (log.isDebugEnabled()) - logMultiline("Fetched OUT parameters", "" + StringUtils.defaultIfNull(record(ctx.configuration(), ctx.routine()), "N/A"), Level.FINE); + if (log.isEnabled(executeLoggingRoutine) && ctx.routine() != null) + logMultiline("Fetched OUT parameters", "" + StringUtils.defaultIfNull(record(ctx.configuration(), ctx.routine()), "N/A"), executeLoggingRoutine); } @Override public void exception(ExecuteContext ctx) { - if (log.isDebugEnabled()) - log.debug("Exception", ctx.exception()); + if (log.isEnabled(executeLoggingException)) + log.log("Exception", ctx.exception(), executeLoggingException); } @SuppressWarnings({ "rawtypes", "unchecked" }) @@ -197,14 +229,9 @@ public class LoggerListener extends DefaultExecuteListener { return result; } - private void logMultiline(String comment, String message, Level level) { + private void logMultiline(String comment, String message, Log.Level level) { for (String line : message.split("\n")) { - if (level == Level.FINE) { - log.debug(comment, line); - } - else { - log.trace(comment, line); - } + log.log(comment, line, level); comment = ""; } diff --git a/jOOQ/src/main/resources/META-INF/ABOUT.txt b/jOOQ/src/main/resources/META-INF/ABOUT.txt index d0eb994a84..bc99776579 100644 --- a/jOOQ/src/main/resources/META-INF/ABOUT.txt +++ b/jOOQ/src/main/resources/META-INF/ABOUT.txt @@ -18,6 +18,7 @@ Authors and contributors of jOOQ or parts of jOOQ in alphabetical order: - Fabrice Le Roy - Gonzalo Ortiz Jaureguizar - Gregory Hlavac +- Grenville Wilson - Henrik Sjöstrand - Ivan Dugic - Javier Durante