Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1452

Reusable messages break flow tracing logic

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.6, 2.6.1
    • 2.6.2
    • Core
    • None

    Description

      Flow tracing assumes that you can save an instance of EntryMessage across a method, but if you log something else within that method and reusable messages are in effect (as they are by default since 2.6), this does not always work properly.

      This code illustrate the issue:

              EntryMessage entryMessage = logger.traceEntry(logger.getMessageFactory().newMessage("the entry"));
              logger.info("something else");
              logger.traceExit(entryMessage);
      

      It works as expected if you remove the middle logger.info(), but with it the exit message gets messed up.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            rpopma Remko Popma
            mikaelstaldal Mikael Ståldal
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment