[ https://issues.apache.org/jira/browse/LOG4J2-2732?focusedWorklogId=355561&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-355561 ]
ASF GitHub Bot logged work on LOG4J2-2732: ------------------------------------------ Author: ASF GitHub Bot Created on: 07/Dec/19 04:23 Start Date: 07/Dec/19 04:23 Worklog Time Spent: 10m Work Description: rgoers commented on pull request #318: [LOG4J2-2732] Add ThreadContext.putIfNull(key, value) helper method URL: https://github.com/apache/logging-log4j2/pull/318 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 355561) Time Spent: 20m (was: 10m) > Add ThreadContext.putIfNull(String, String) > ------------------------------------------- > > Key: LOG4J2-2732 > URL: https://issues.apache.org/jira/browse/LOG4J2-2732 > Project: Log4j 2 > Issue Type: New Feature > Components: API > Reporter: Matt Pavlovich > Priority: Major > Time Spent: 20m > Remaining Estimate: 0h > > 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. > {noformat} > if(!ThreadContext.containsKey("uniqueId")) { > ThreadContext.put("uniqueId", generateUniqueId()); > } > {noformat} > Proposed: > {noformat} > ThreadContext.putIfNull("uniqueId", generateUniqueId()); > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)