]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Debug logging through SLF4J Logger for Expressions
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 27 Aug 2018 14:01:39 +0000 (17:01 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Sat, 1 Sep 2018 08:22:44 +0000 (11:22 +0300)
gitlab #88

Change-Id: I7917e8a207e99bf92feab50291bcb3d85e108cf3
(cherry picked from commit a43df9e895f022132f9b94dfedeae78fb4eed712)

bundles/org.simantics.basicexpression/META-INF/MANIFEST.MF
bundles/org.simantics.basicexpression/src/org/simantics/basicexpression/Expressions.java

index e13549a2fb9de2203eb42662f24be5e656b33a80..ad2133153f2e227b94e0d862ebc8032f0e7552c0 100644 (file)
@@ -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"
index ae28f399b707cd9b02070a5a17b46665e9a27e90..51dae6c3698c61ded4bed6b9b8eae6b4be85520a 100644 (file)
@@ -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);
-        }        
-        
+        }
+
     }
 
 }