Uploaded image for project: 'SLF4J'
  1. SLF4J
  2. SLF4J-477

Add New Exception for Stack Trace Dumps

    XMLWordPrintable

Details

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • None
    • None

    Description

      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.

      LOG.trace("Stack Trace Dump", new Exception());
      

      The output is something like:

      2019-11-19T08:13:31,392 TRACE [Logger] Class: Stack Trace Dump
      java.lang.Exception: null
       at
      ...
      

       

      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.

       

      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
      ...
      

      Attachments

        Activity

          People

            slf4j-dev SLF4J developers list
            BELUGABEHR DAVID MOLLITOR
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: