Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036444Openbravo ERPA. Platformpublic2017-07-07 11:162017-09-21 16:49
alostale 
alostale 
normalminorhave not tried
closedfixed 
5
 
3.0PR17Q4 
shuehner
Core
No
0036444: SqlC generated code hides stack traces in case of error
When a query executed by a generated SqlC method fails, an error is logged but there is no way to see stack trace of where it occurred.
- Execute ErrorTextParserTest
  -> Check output:
    There are output lines like following that do not include stack traces:
    14768 [main] ERROR org.openbravo.test.system.ErrorTextParserTestData - SQL error in query: DELETE FROM AD_CLIENT WHERE AD_CLIENT_ID = ?Exception:org.postgresql.util.PSQLException: ERROR: update or delete on table "ad_client" violates foreign key constraint "ad_alert_ad_client" on table "ad_alert"
  Detail: Key (ad_client_id)=(0) is still referenced from table "ad_alert".
Statements can fail due to:
1. Technical reasons
2. Functional ones (ie. trying to insert/update prevented by a constraint/trigger)

In general for 2nd cases stack traces are not interesting and would pollute logs whereas stack traces for 1st cases would be interesting to help debugging. Differentiating those cases in code is not possible/easy.

As a compromise solution:

- By default stack traces won't be logged, as currently is done
- In case logger is set to debug level stack trace will be logged
No tags attached.
related to defect 0036429 closed shuehner SqlC generates code using printStackTrace which should not be used 
has duplicate feature request 0011261 closed platform In Sqlc generated code include stack trace in error logs 
blocks design defect 0036162 acknowledged Triage Platform Base clean up openbravo.log 
Issue History
2017-07-07 11:16alostaleNew Issue
2017-07-07 11:16alostaleAssigned To => platform
2017-07-07 11:16alostaleModules => Core
2017-07-07 11:16alostaleTriggers an Emergency Pack => No
2017-07-07 11:16alostaleRelationship addedrelated to 0036429
2017-07-07 11:17alostaleRelationship addedblocks 0036162
2017-07-07 11:22alostaleReview Assigned To => shuehner
2017-07-07 12:29alostaleAssigned Toplatform => alostale
2017-07-07 12:33hgbotCheckin
2017-07-07 12:33hgbotNote Added: 0097944
2017-07-07 12:33hgbotStatusnew => resolved
2017-07-07 12:33hgbotResolutionopen => fixed
2017-07-07 12:33hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/36b24dd5e2ff0d8e544868ef18900f92862e22ff [^]
2017-07-07 12:38alostaleSummarySqlC generates code hides stack traces in case of error => SqlC generated code hides stack traces in case of error
2017-07-10 08:50hgbotCheckin
2017-07-10 08:50hgbotNote Added: 0097961
2017-07-31 13:06shuehnerNote Added: 0098274
2017-07-31 13:06shuehnerStatusresolved => closed
2017-07-31 13:06shuehnerFixed in Version => 3.0PR17Q4
2017-09-21 16:49hudsonbotCheckin
2017-09-21 16:49hudsonbotNote Added: 0099246
2017-09-21 16:49hudsonbotCheckin
2017-09-21 16:49hudsonbotNote Added: 0099251
2017-11-06 08:31alostaleRelationship addedhas duplicate 0011261

Notes
(0097944)
hgbot   
2017-07-07 12:33   
Repository: erp/devel/pi
Changeset: 36b24dd5e2ff0d8e544868ef18900f92862e22ff
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jul 07 12:28:04 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/36b24dd5e2ff0d8e544868ef18900f92862e22ff [^]

fixed bug 36444: SqlC generates code hides stack traces in case of error

  Show stack traces when error occurs in sqlc methods. By default it is still not
  shown, but it can be enabled by setting DEBUG log lovel.

---
M src-core/src/org/openbravo/data/Sqlc.java
M src-test/src/org/openbravo/test/base/TestLogAppender.java
M src-test/src/org/openbravo/test/system/ErrorTextParserTest.java
---
(0097961)
hgbot   
2017-07-10 08:50   
Repository: erp/devel/pi
Changeset: 6203c605f7397ef953cb750d930fa143f940da36
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon Jul 10 08:49:51 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/6203c605f7397ef953cb750d930fa143f940da36 [^]

related with bug 36444: make optional to log stack traces in tests

  In test infrastructure is now optional (and disabled by default) to log stack
  traces. This restores the previous behavior where they were never logged.

---
M src-test/src/org/openbravo/test/base/OBBaseTest.java
M src-test/src/org/openbravo/test/base/TestLogAppender.java
M src-test/src/org/openbravo/test/system/ErrorTextParserTest.java
---
(0098274)
shuehner   
2017-07-31 13:06   
Tested & reviewed.
Test done via running & checking the junit testcase which has been added to test the change.
(0099246)
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
(0099251)
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