[
https://jira.qos.ch/browse/SLF4J-477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19990#comment-19990
]
DAVID MOLLITOR commented on SLF4J-477:
--------------------------------------
Alternatively, provide some sort of static token or marker that produces a
stack trace so that the stack trace is only collected if the logging level is
enabled.
> Add New Exception for Stack Trace Dumps
> ---------------------------------------
>
> Key: SLF4J-477
> URL: https://jira.qos.ch/browse/SLF4J-477
> Project: SLF4J
> Issue Type: New Feature
> Reporter: DAVID MOLLITOR
> Assignee: SLF4J developers list
>
> I have seen many examples where developers want to dump a stack trace to the
> log system simply to track the execution path of the Thread and not
> associated with any real issue.
> {code:java}
> LOG.trace("Stack Trace Dump", new Exception());
> {code}
> The output is something like:
> {code:none}
> 2019-11-19T08:13:31,392 TRACE [Logger] Class: Stack Trace Dump
> java.lang.Exception: null
> at
> ...
> {code}
>
> I would like to propose that SLF4J ships with an {{Exception}} class specific
> to this scenario. A user could easily mistake this as logging as being
> related to a real error condition instead of its intended informational
> purpose because it has the word 'Exception' in it and may be interpreted as
> being related to an erroneous 'null' value.
>
> {code:java}
> LOG.trace("Stack Trace Dump", new StackTraceDump());
> 2019-11-19T08:13:31,392 TRACE [Logger] Class: Stack Trace Dump
> ch.qos.slf4f.StackTraceDump: Dumping stack trace
> at
> ...
> {code}
--
This message was sent by Atlassian JIRA
(v7.3.1#73012)
_______________________________________________
slf4j-dev mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/slf4j-dev