carterkozak commented on a change in 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_r296492908
########## 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: Could we keep a single builder with a `reserved` flag? If the current value is reserved, we can remove it from the threadlocal and create a new instance for the nested logger. I think that works well for ReusableParameterizedMessage, and limits the per-thread memory we can retain. It think nested log statements are uncommon enough that we don't need to make them allocation free, though they may be more common using a builder API than the standard style APIs. ---------------------------------------------------------------- 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 With regards, Apache Git Services