[
https://issues.apache.org/jira/browse/CALCITE-4151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17168563#comment-17168563
]
Stamatis Zampetakis commented on CALCITE-4151:
----------------------------------------------
This is open to discussion but I opened directly the JIRA so that it happens
directly under the issue and no matter the decision we keep the trace.
> Forbid usages of Exception#printStackTrace variants
> ---------------------------------------------------
>
> Key: CALCITE-4151
> URL: https://issues.apache.org/jira/browse/CALCITE-4151
> Project: Calcite
> Issue Type: Improvement
> Reporter: Stamatis Zampetakis
> Assignee: Stamatis Zampetakis
> Priority: Minor
>
> Exception#printStackTrace is a convenient way to print stack trace related
> information to standard error and potentially other output streams. However,
> most of the time (if not always) is a bad idea to do so. There are many
> articles online, outlining why it is not a good idea to use these APIs.
> Briefly instead of calling Exception#printStackTrace someone should:
> * Log it using a logger and the appropriate level (e.g
> [LOG.error|http://www.slf4j.org/apidocs/org/slf4j/Logger.html#error(java.lang.String,java.lang.Throwable)],
>
> [LOG.info|http://www.slf4j.org/apidocs/org/slf4j/Logger.html#info(java.lang.String,java.lang.Throwable)],
> etc.)
> * Re-throw the exception wrapping it if necessary
> * Let the exception propagate and let other callers act as they see fit
> In this issue we aim to replace existing calls with appropriate alternatives
> (as mentioned above) and add the API to the list of forbidden signatures.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)