[ https://issues.apache.org/jira/browse/LOG4J2-2639?focusedWorklogId=265418&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-265418 ]
ASF GitHub Bot logged work on LOG4J2-2639: ------------------------------------------ Author: ASF GitHub Bot Created on: 23/Jun/19 17:37 Start Date: 23/Jun/19 17:37 Worklog Time Spent: 10m Work Description: carterkozak commented on pull request #284: LOG4J2-2639 - Allow logging calls to be constructed using a builder pattern URL: https://github.com/apache/logging-log4j2/pull/284#discussion_r296490927 ########## File path: log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java ########## @@ -2734,4 +2748,108 @@ public void warn(final String message, final Object p0, final Object p1, final O final Object p7, final Object p8, final Object p9) { logIfEnabled(FQCN, Level.WARN, null, message, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); } + + /** + * Constuct a trace log event. + * @return a LogBuilder. + * @since 3.0 + */ + @Override + public LogBuilder atTrace() { + if (isTraceEnabled()) { + return logBuilder.get().setLevel(Level.TRACE); Review comment: I think we need something similar to `ReusableParameterizedMessage.reserved` for this to work, otherwise we will clobber threadlocal state with something like this: ```java private void func() { log.atInfo().withMessage("Value {}").withParameters(getValue()).log(); } private Object getValue() { log.atInfo().withMessage("Getting Value").log(); return value; } ``` ---------------------------------------------------------------- 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: 265418) Time Spent: 0.5h (was: 20m) > Allow log event to be created using the builder pattern. > -------------------------------------------------------- > > Key: LOG4J2-2639 > URL: https://issues.apache.org/jira/browse/LOG4J2-2639 > Project: Log4j 2 > Issue Type: Task > Components: API > Affects Versions: 3.0.0 > Reporter: Ralph Goers > Priority: Major > Time Spent: 0.5h > Remaining Estimate: 0h > > In some cases it would be convenient to create log events using a builder > pattern. One advantage of this approach is that it would allow the location > information to be more easily provided. -- This message was sent by Atlassian JIRA (v7.6.3#76005)