Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036527Openbravo ERPA. Platformpublic2017-07-24 11:472017-07-28 15:27
alostale 
alostale 
normalminorhave not tried
closedfixed 
5
 
3.0PR17Q4 
caristu
Core
No
0036527: OBException should not log itself by default
Currently default behavior of OBException constructors is to log the newly created instance including stack trace.

This, in most of the cases, creates unnecessary log.

Note this pattern is also used in many places, which makes things worse, as the exception including its stack trace is logged twice:
  
  try {
    ...
    if (failed) throw new OBException("Something failed");
  } catch (OBexception e) {
    log.error("Something failed", e);
    ...
  }
Write and execute:

new OBException("something failed");

check it generates log including stack trace
This behavior is going to be changed so auto log will occur only if:
* It is explicitly indicated to constructor through boolean parameter
* Logger for the exception class is set to at least debug level

See: http://wiki.openbravo.com/wiki/How_To_Log#OBException [^]
No tags attached.
related to defect 0036183 closed platform Openbravo ERP Platform: EntityPersistenceEventObserver validations has a high log level 
related to defect 0036207 closed markmm82 Openbravo ERP Finance: EntityPersistenceEventObserver validations has a high log level 
related to defect 0036208 new Retail Retail Modules Retail: EntityPersistenceEventObserver validations has a high log level 
blocks design defect 0036162 acknowledged Triage Platform Base Openbravo ERP clean up openbravo.log 
Issue History
2017-07-24 11:47alostaleNew Issue
2017-07-24 11:47alostaleAssigned To => platform
2017-07-24 11:47alostaleModules => Core
2017-07-24 11:47alostaleTriggers an Emergency Pack => No
2017-07-24 11:48alostaleDescription Updatedbug_revision_view_page.php?rev_id=15539#r15539
2017-07-24 11:48alostaleProposed Solution updated
2017-07-24 11:49alostaleRelationship addedblocks 0036162
2017-07-24 11:49alostaleAssigned Toplatform => alostale
2017-07-24 12:05alostaleReview Assigned To => caristu
2017-07-24 12:06alostaleRelationship addedrelated to 0036183
2017-07-24 12:06hgbotCheckin
2017-07-24 12:06hgbotNote Added: 0098195
2017-07-24 12:06alostaleRelationship addedrelated to 0036207
2017-07-24 12:06hgbotStatusnew => resolved
2017-07-24 12:06hgbotResolutionopen => fixed
2017-07-24 12:06hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/9c333865058f015c5ee62ce023b95a1efd9210c3 [^]
2017-07-24 12:07alostaleRelationship addedrelated to 0036208
2017-07-28 15:27caristuNote Added: 0098263
2017-07-28 15:27caristuStatusresolved => closed
2017-07-28 15:27caristuFixed in Version => 3.0PR17Q4

Notes
(0098195)
hgbot   
2017-07-24 12:06   
Repository: erp/devel/pi
Changeset: 9c333865058f015c5ee62ce023b95a1efd9210c3
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jul 21 07:48:49 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/9c333865058f015c5ee62ce023b95a1efd9210c3 [^]

fixed 36527: OBException should not log itself by default

  Changed default OBException behavior: now it only logs itself on creation if
  explicitly set or if loger level is debug

---
M src/org/openbravo/base/exception/OBException.java
---
(0098263)
caristu   
2017-07-28 15:27   
Code reviewed + testing OK.