Bug 52628 - [PATCH] Replace System.err calls with Logger call
Summary: [PATCH] Replace System.err calls with Logger call
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 3.9-dev
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-09 12:02 UTC by Torsten Krah
Modified: 2012-11-16 12:24 UTC (History)
1 user (show)



Attachments
Patch against rev 1404603 (19.90 KB, patch)
2012-11-01 18:55 UTC, Jeremy
Details | Diff
Patch against rev 1406238 (37.34 KB, patch)
2012-11-06 17:56 UTC, Jeremy
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Torsten Krah 2012-02-09 12:02:20 UTC
This is more a enhancement / feature request - did not found any task yet for this one, maybe its a duplicate.

There are some System.err calls in the Poi code, e.g. Sheet.java in Scratchpad.
May it be possible that these call are replaced by a call to $logger.error(...) instead to integrate them in the logging system a user may choose?
Comment 1 Nick Burch 2012-02-09 12:04:32 UTC
Would it be possible for you to work up a patch to do this change?
Comment 2 Torsten Krah 2012-02-09 12:18:51 UTC
Yes i can do this patch and submit it.
Is it enough to do this against latest trunk?
Comment 3 Torsten Krah 2012-02-09 13:42:18 UTC
Patch question: Would you like to have a logger per name or a logger per class, e.g. getLogger("poi-error") and all system.err calls use this one, or should it be a getLogger(XXX.class) one?
Comment 4 Yegor Kozlov 2012-02-10 11:40:11 UTC
getLogger(XXX.class) should be fine.

Yegor

(In reply to comment #3)
> Patch question: Would you like to have a logger per name or a logger per class,
> e.g. getLogger("poi-error") and all system.err calls use this one, or should it
> be a getLogger(XXX.class) one?
Comment 5 Jeremy 2012-11-01 18:53:40 UTC
A patch file has been supplied for fixing this issue by replacing most instances of System.err with a POILogFactory.getLogger() logger.

SerialVersionUID's and proper Argument types were applied to lists.

The most complex changes were applied to the HPSFRuntimeException() class where the print stack trace logic was removed where System.err was being explicitly declared.   By commenting this out, the base RuntimeException printStackTrace logic should prevail.

The soon to be added patch file was applied to the current POI daily trunk 3.9-beta1 on November 1st, 2012. Revision (1404603)
Comment 6 Jeremy 2012-11-01 18:55:44 UTC
Created attachment 29540 [details]
Patch against rev 1404603
Comment 7 Jeremy 2012-11-06 17:45:51 UTC
For some reason scracthpad was not imported into eclipse when I imported from the ant build file.  I ended up missing the System.err calls from that project.  A newer more complete patch file is being attached shortly that uses loggers for scratchpad related code as well.  This will replace the prior patch file.
Comment 8 Jeremy 2012-11-06 17:56:06 UTC
Created attachment 29561 [details]
Patch against rev 1406238

Replace System.err info messages with a POILogger.
Comment 9 Yegor Kozlov 2012-11-16 12:24:04 UTC
Thanks for the patch, applied in r1410318

Yegor