From a43df9e895f022132f9b94dfedeae78fb4eed712 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Mon, 27 Aug 2018 17:01:39 +0300 Subject: [PATCH] Debug logging through SLF4J Logger for Expressions gitlab #88 Change-Id: I7917e8a207e99bf92feab50291bcb3d85e108cf3 --- .../META-INF/MANIFEST.MF | 1 + .../org/simantics/basicexpression/Expressions.java | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bundles/org.simantics.basicexpression/META-INF/MANIFEST.MF b/bundles/org.simantics.basicexpression/META-INF/MANIFEST.MF index e13549a2f..ad2133153 100644 --- a/bundles/org.simantics.basicexpression/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.basicexpression/META-INF/MANIFEST.MF @@ -11,3 +11,4 @@ Export-Package: org.simantics.basicexpression, org.simantics.basicexpression.lexer, org.simantics.basicexpression.node, org.simantics.basicexpression.parser +Require-Bundle: org.slf4j.api;bundle-version="1.7.25" diff --git a/bundles/org.simantics.basicexpression/src/org/simantics/basicexpression/Expressions.java b/bundles/org.simantics.basicexpression/src/org/simantics/basicexpression/Expressions.java index ae28f399b..51dae6c36 100644 --- a/bundles/org.simantics.basicexpression/src/org/simantics/basicexpression/Expressions.java +++ b/bundles/org.simantics.basicexpression/src/org/simantics/basicexpression/Expressions.java @@ -18,9 +18,13 @@ import org.simantics.basicexpression.analysis.DepthFirstAdapter; import org.simantics.basicexpression.lexer.Lexer; import org.simantics.basicexpression.node.Start; import org.simantics.basicexpression.parser.Parser; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class Expressions { + private static final Logger LOGGER = LoggerFactory.getLogger(Expressions.class); + private static final boolean DEBUG = false; public static void evaluate(String expression, DepthFirstAdapter evaluator) { @@ -47,10 +51,11 @@ public class Expressions { } catch(Exception e) { - e.printStackTrace(); + if (LOGGER.isDebugEnabled()) + LOGGER.debug("Failed to evaluate expression {}", expression, e); evaluator.except(e); - } - + } + } } -- 2.47.1