Openbravo Issue Tracking System - Retail Modules
View Issue Details
0045169Retail ModulesSessionspublic2020-10-01 15:452021-11-10 17:10
shuehner 
justin_patterson 
normalminorhave not tried
closedfixed 
5
 
 
No
0045169: Sessions module uses bad logging (printStrackTrace)
Those bad logging example should be moved to proper log4j.error instead
pmods/org.openbravo.retail.sessions/src/org/openbravo/retail/sessions/CashUpDetailsDatasource.java: e.printStackTrace();
pmods/org.openbravo.retail.sessions/src/org/openbravo/retail/sessions/SetBusinessDate.java: e.printStackTrace();
No tags attached.
blocks design defect 0036162 acknowledged Triage Platform Base Openbravo ERP clean up openbravo.log 
Issue History
2020-10-01 15:45shuehnerNew Issue
2020-10-01 15:45shuehnerAssigned To => platform
2020-10-01 15:45shuehnerModules => Core
2020-10-01 15:45shuehnerTriggers an Emergency Pack => No
2020-10-07 13:59alostaleNote Added: 0123605
2020-10-07 14:01alostaleProjectOpenbravo ERP => Retail Modules
2020-10-07 14:01alostaleAssigned Toplatform => Retail
2020-10-07 14:01alostaleCategoryA. Platform => Sessions
2020-10-07 14:02alostaleRelationship addedblocks 0036162
2021-11-03 15:07shuehnerSummarySome exceptions raised in ImportEntry processing end up being logged in catalina.out (and not using log4j2) => Sessions module uses bad logging (printStrackTrace)
2021-11-03 15:07shuehnerDescription Updatedbug_revision_view_page.php?rev_id=23270#r23270
2021-11-03 15:07shuehnerSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=23272#r23272
2021-11-03 15:07shuehnerProposed Solution updated
2021-11-04 08:17marvintmStatusnew => scheduled
2021-11-04 08:17marvintmAssigned ToRetail => justin_patterson
2021-11-10 09:40hgbotNote Added: 0132927
2021-11-10 17:10hgbotResolutionopen => fixed
2021-11-10 17:10hgbotStatusscheduled => closed
2021-11-10 17:10hgbotNote Added: 0132943
2021-11-10 17:10hgbotNote Added: 0132944

Notes
(0123605)
alostale   
2020-10-07 13:59   
The problem for the reported case is in sessions module [1]:
    } catch (ParseException e) {
      e.printStackTrace();
    }


On top of simply logging with log4j:
* Add some relevant context to know the reason it failed
* Even more important: is it ok to just catch and ignore the exception responding success?

---
[1] https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.sessions/-/blob/dcd7d06b11da3820b31441a66d7a1b1a3225b41c/src/org/openbravo/retail/sessions/SetBusinessDate.java#L74 [^]
(0132927)
hgbot   
2021-11-10 09:40   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.sessions/-/merge_requests/29 [^]
(0132943)
hgbot   
2021-11-10 17:10   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.sessions [^]
Changeset: 0509922099e685ebcc57a4888113082c7f49b1fa
Author: Justin Patterson <justin.patterson@openbravo.com>
Date: 2021-11-10T16:42:56+01:00
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.sessions/-/commit/0509922099e685ebcc57a4888113082c7f49b1fa [^]

Fixed ISSUE-45169: moved logging to log4j
- imported log4j LogManager
- instantiated logger
- replaced e.printStackTrace with logger.error(e.printMessage())
- added JSON object "result" to store JSONConstants data and return on error

---
M src/org/openbravo/retail/sessions/CashUpDetailsDatasource.java
M src/org/openbravo/retail/sessions/SetBusinessDate.java
---
(0132944)
hgbot   
2021-11-10 17:10   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.sessions/-/merge_requests/29 [^]