Repository: calcite Updated Branches: refs/heads/master a4bcea8c5 -> a3711d78d
[CALCITE-2463] Silence ERROR logs from CalciteException, SqlValidatorException Output exception messages to logger only in calcite.debug=true mode Close #797 Project: http://git-wip-us.apache.org/repos/asf/calcite/repo Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/a3711d78 Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/a3711d78 Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/a3711d78 Branch: refs/heads/master Commit: a3711d78d450b7183a65e0ce695527ca92218bd8 Parents: a4bcea8 Author: Vladimir Sitnikov <[email protected]> Authored: Sun Aug 19 18:59:13 2018 +0300 Committer: Volodymyr Vysotskyi <[email protected]> Committed: Mon Dec 24 20:07:25 2018 +0200 ---------------------------------------------------------------------- .../main/java/org/apache/calcite/runtime/CalciteException.java | 6 +++++- .../org/apache/calcite/sql/validate/SqlValidatorException.java | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/calcite/blob/a3711d78/core/src/main/java/org/apache/calcite/runtime/CalciteException.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/calcite/runtime/CalciteException.java b/core/src/main/java/org/apache/calcite/runtime/CalciteException.java index 402fa90..3250f44 100644 --- a/core/src/main/java/org/apache/calcite/runtime/CalciteException.java +++ b/core/src/main/java/org/apache/calcite/runtime/CalciteException.java @@ -16,6 +16,8 @@ */ package org.apache.calcite.runtime; +import org.apache.calcite.prepare.CalcitePrepareImpl; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,7 +60,9 @@ public class CalciteException extends RuntimeException { // TODO: Force the caller to pass in a Logger as a trace argument for // better context. Need to extend ResGen for this. LOGGER.trace("CalciteException", this); - LOGGER.error(toString()); + if (CalcitePrepareImpl.DEBUG) { + LOGGER.error(toString()); + } } } http://git-wip-us.apache.org/repos/asf/calcite/blob/a3711d78/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorException.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorException.java b/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorException.java index 7a8bbdf..a81bd85 100644 --- a/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorException.java +++ b/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorException.java @@ -16,6 +16,7 @@ */ package org.apache.calcite.sql.validate; +import org.apache.calcite.prepare.CalcitePrepareImpl; import org.apache.calcite.util.CalciteValidatorException; import org.slf4j.Logger; @@ -56,7 +57,9 @@ public class SqlValidatorException extends Exception // TODO: see note in CalciteException constructor LOGGER.trace("SqlValidatorException", this); - LOGGER.error(toString()); + if (CalcitePrepareImpl.DEBUG) { + LOGGER.error(toString()); + } } }
