[logback-dev] [JIRA] (LOGBACK-1318) LoggingEvent.prepareForDeferredProcessing doesn't need to call LoggingEvent.getFormattedMessage

QOS.CH (JIRA) noreply-jira at qos.ch
Fri Jun 23 17:35:00 CEST 2017


William Li created LOGBACK-1318:
-----------------------------------

             Summary: LoggingEvent.prepareForDeferredProcessing doesn't need to call LoggingEvent.getFormattedMessage
                 Key: LOGBACK-1318
                 URL: https://jira.qos.ch/browse/LOGBACK-1318
             Project: logback
          Issue Type: Improvement
          Components: logback-classic
            Reporter: William Li
            Assignee: Logback dev list
            Priority: Minor


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|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.
{quote}public void prepareForDeferredProcessing() \{
    _*this.getFormattedMessage();*_
    this.getThreadName();
    // fixes http://jira.qos.ch/browse/LBCLASSIC-104
    this.getMDCPropertyMap();
}{quote}



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the logback-dev mailing list