carterkozak commented on issue #284: LOG4J2-2639 - Allow logging calls to be 
constructed using a builder pattern
URL: https://github.com/apache/logging-log4j2/pull/284#issuecomment-505562983
 
 
   I'm worried about memory leaks in calls that never invoke `log()`
   
   ```java
   logger.info().message("Hello, {}!", "World").marker(getMarker() /* throws! 
*/).log();
   ```
   
   In this case, we would apply data to a message factory, building a message 
object, but never release threadlocal parameter references.
   
   We could do something along the lines of `info(Consumer<LogBuilder>)` and 
remove `build()` from the LogBuilder, however the fluent usage would never be 
garbage free. We would get a guarantee that we could release resources on both 
success and failure, but the API would be more difficult to use.

----------------------------------------------------------------
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

Reply via email to