Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036429Openbravo ERPA. Platformpublic2017-07-06 12:262017-09-21 16:49
shuehner 
shuehner 
normalminorhave not tried
closedfixed 
5
 
3.0PR17Q4 
alostale
Core
No
0036429: SqlC generates code using printStackTrace which should not be used
This issue is part of getting rid of bad logging especially by not using printStackTrace as it is logged on stdout (catalina.out) without timestamp of context information.

SqlC current generates printStackTrace in the code in a catch block when an exception is raised while closing the statement/connection.

This issue will change that code to use the standard/proper log4j call.

Also based on feedback from ALO it adds context information (full sql statement) to make debugging easier if that case should happen.
Check code generated from xsql and notice it using printStackTrace.
-
No tags attached.
related to design defect 0036162 acknowledged Triage Platform Base clean up openbravo.log 
related to defect 0036444 closed alostale SqlC generated code hides stack traces in case of error 
Issue History
2017-07-06 12:26shuehnerNew Issue
2017-07-06 12:26shuehnerAssigned To => shuehner
2017-07-06 12:26shuehnerModules => Core
2017-07-06 12:26shuehnerTriggers an Emergency Pack => No
2017-07-06 12:26shuehnerRelationship addedrelated to 0036162
2017-07-06 12:28shuehnerNote Added: 0097905
2017-07-06 16:01hgbotCheckin
2017-07-06 16:01hgbotNote Added: 0097919
2017-07-06 16:01hgbotStatusnew => resolved
2017-07-06 16:01hgbotResolutionopen => fixed
2017-07-06 16:01hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/415e2a692c2da44c1c503cea8c5e259480b58336 [^]
2017-07-06 16:02shuehnerReview Assigned To => alostale
2017-07-07 09:24alostaleNote Added: 0097928
2017-07-07 09:24alostaleStatusresolved => closed
2017-07-07 09:24alostaleFixed in Version => 3.0PR17Q4
2017-07-07 10:22hgbotCheckin
2017-07-07 10:22hgbotNote Added: 0097934
2017-07-07 11:16alostaleRelationship addedrelated to 0036444
2017-09-21 16:49hudsonbotCheckin
2017-09-21 16:49hudsonbotNote Added: 0099244

Notes
(0097905)
shuehner   
2017-07-06 12:28   
Example change in the generated code:
@@ -117,8 +117,8 @@
     } finally {
       try {
         connectionProvider.releasePreparedStatement(st);
- } catch(Exception ignore){
- ignore.printStackTrace();
+ } catch(Exception e){
+ log4j.error("Error during release*Statement of query: " + strSql, e);
       }
     }
     return(updateCount);
(0097919)
hgbot   
2017-07-06 16:01   
Repository: erp/devel/pi
Changeset: 415e2a692c2da44c1c503cea8c5e259480b58336
Author: Stefan Hühner <stefan.huehner <at> openbravo.com>
Date: Thu Jul 06 12:31:24 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/415e2a692c2da44c1c503cea8c5e259480b58336 [^]

Fixed 36429. Change code-generation to not use printStackTrace but log4j.error

printStackTrace should not be used but the standard log4j.error instead. This
changes the SqlC code-generator which had 1 common case left not following this.
Also it adds strSql as context to the logging message to make debugging easier.

---
M src-core/src/org/openbravo/data/Sqlc.java
---
(0097928)
alostale   
2017-07-07 09:24   
reviewed
(0097934)
hgbot   
2017-07-07 10:22   
Repository: erp/devel/pi
Changeset: a91838c63b773a0425c81b4c82dd1a395661aa07
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jul 07 10:21:47 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/a91838c63b773a0425c81b4c82dd1a395661aa07 [^]

related to bug 36429: printStackTrace on sqlc queries

  Fixed cases that do not directly use generated classes but a static
  copy of them.

---
M src/org/openbravo/erpCommon/ad_process/AlertProcess.java
---
(0099244)
hudsonbot   
2017-09-21 16:49   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/9750b78d3e5c [^]
Maturity status: Test