details:   https://code.openbravo.com/erp/devel/pi/rev/8e6d5fa6f5d4
changeset: 35529:8e6d5fa6f5d4
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue Mar 12 10:42:53 2019 +0100
summary:   fixed issue 40355: reduced log level for xmlEngine "Data not 
defined" msg

  * This is a message that should only be reviewed while developing xmlEngine 
forms
    but should not appear in production logs, therefore it's been reduced to 
DEBUG.
  * Show log and context in the same line
  * Show stacktrace whenever it is available to give more context
  * Show generic error message for unknown ones

diffstat:

 src-core/src/org/openbravo/xmlEngine/ErrorManagement.java |  17 +++++++-------
 1 files changed, 8 insertions(+), 9 deletions(-)

diffs (51 lines):

diff -r bc6165498b86 -r 8e6d5fa6f5d4 
src-core/src/org/openbravo/xmlEngine/ErrorManagement.java
--- a/src-core/src/org/openbravo/xmlEngine/ErrorManagement.java Tue Mar 12 
08:56:48 2019 +0100
+++ b/src-core/src/org/openbravo/xmlEngine/ErrorManagement.java Tue Mar 12 
10:42:53 2019 +0100
@@ -1,6 +1,6 @@
 /*
  
************************************************************************************
- * Copyright (C) 2001-2010 Openbravo S.L.U.
+ * Copyright (C) 2001-2019 Openbravo S.L.U.
  * Licensed under the Apache Software License version 2.0
  * You may obtain a copy of the License at 
http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to  in writing,  software  
distributed
@@ -11,6 +11,7 @@
  */
 package org.openbravo.xmlEngine;
 
+import org.apache.logging.log4j.Level;
 /*  Error management for XmlEngine
  To add a new error, in the location where the error is produced include:
  ErrorManagement.error(nn, location [, exception]);
@@ -32,10 +33,12 @@
   }
 
   public static void error(int i, String locationText, Exception e) {
-    String errorText = "";
+    String errorText;
+    Level logLevel = Level.ERROR;
     switch (i) {
       case 101:
         errorText = "Data not defined for structure";
+        logLevel = Level.DEBUG;
         // The setData has not been made in the structure of a XmlDocument
         // or a sql sentece was not specified in the configuration file
         break;
@@ -67,14 +70,10 @@
         // error when parsing the .xml file, for example badly nested tags
         // or badly closed
         break;
+      default:
+        errorText = "Error";
     }
-    log4jErrorManagement.error(errorText);
-    log4jErrorManagement.error("in " + locationText);
-    if (log4jErrorManagement.isDebugEnabled() && e != null) {
-      e.getMessage();
-      e.printStackTrace();
-    }
-
+    log4jErrorManagement.log(logLevel, "{} - in {}", errorText, locationText, 
e);
   }
 
 }


_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to