Details
-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
None
Description
LoggingEvent.prepareForDeferredProcessing should be called when using asynchronous or deferred logging. The code is as blow. The first line may cause log event serialization, which is time-cosuming when the message is big. Actually, it is not need to have this line of code. The code was added in https://github.com/qos-ch/logback/commit/dfd340815e36f475cd014fd85915dbbafa739d4f by Ceki Gulcu in 2010. The comment is "all logback-classic and logback-core tests pass". Actually, no test case failure if this line is removed. I would suggest to remove this line, so that the log event will not be serialized untile the logger thread really need the formatted message.
public void prepareForDeferredProcessing() {
this.getFormattedMessage();
this.getThreadName();
// fixes http://jira.qos.ch/browse/LBCLASSIC-104
this.getMDCPropertyMap();
}