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

Add ThreadContext.putIfNull(String, String)

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.13.0
    • Component/s: API
    • Labels:
      None

      Description

      Provide a helper method that provides a 1-liner to put an identifier only if it is not currently set. This removes an if-check in all classes that share a design approach of assessing a uniqueId, such as request id, etc.

      if(!ThreadContext.containsKey("uniqueId")) {
         ThreadContext.put("uniqueId", generateUniqueId());
      }
      

      Proposed:

      ThreadContext.putIfNull("uniqueId", generateUniqueId());
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mattrpav Matt Pavlovich

              Dates

              • Created:
                Updated:
                Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0h
              0h
              Logged:
              Time Spent - 20m
              20m

                Issue deployment