[logback-dev] [JIRA] Commented: (LBCLASSIC-31) Avoid printing stack traces under certain conditions
Robert Elliot (JIRA)
noreply-jira at qos.ch
Thu Nov 6 00:55:21 CET 2008
[ http://jira.qos.ch/browse/LBCLASSIC-31?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10878#action_10878 ]
Robert Elliot commented on LBCLASSIC-31:
----------------------------------------
I'm probably missing something, but if you don't want the stacktrace, why pass the exception to the info method?
> Avoid printing stack traces under certain conditions
> ----------------------------------------------------
>
> Key: LBCLASSIC-31
> URL: http://jira.qos.ch/browse/LBCLASSIC-31
> Project: logback-classic
> Issue Type: Improvement
> Components: Other
> Affects Versions: unspecified
> Environment: Operating System: Windows
> Platform: PC
> Reporter: Ceki Gulcu
> Assignee: Logback dev list
> Priority: Minor
>
> It would be useful if under certain very specific conditions, logback avoided printing stack traces.
> In particular, in server applications IOEXceptions are thrown under normal conditions, such as when the client closes its connection to the server.
> Typical code would look like:
> try {
> event = (AuditEvent) ois.readObject();
> } catch (java.io.EOFException e) {
> logger.info("Caught java.io.EOFException closing connection.", e);
> break;
> } catch (IOException e) {
> logger.info("Caught java.io.IOException: ", e);
> break;
> } catch (ClassNotFoundException e) {
> logger.error("Unexpected ClassNotFoundException.", e);
> writeResponse(e);
> break;
> }
> Most of the time we would like to avoid printing the stack trace for the two exceptions but not the third.
> Possible solution:
> Marker ignoreST = MarkerFactgory.getMarker("IGNORE_STACK_TRACE");
> logger.info(ignoreST, "Caught java.io.EOFException closing connection.", e);
> Note that even if most of the time we would like to avoid printing the stack trace, it should still be possible to allow st printing by overriding some parameter.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the logback-dev
mailing list