Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-11901

Improve how logging collects class name information

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Done
    • None
    • 7.4
    • None
    • None

    Description

      The log4j.properties that we ship with Solr has this Pattern

      %d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
      

      The %c collects class name information ( more on this http://logging.apache.org/log4j/2.x/manual/async.html#Location ) which creates a throwable ( https://github.com/apache/log4j/blob/trunk/src/main/java/org/apache/log4j/spi/LoggingEvent.java#L253 ) and it can be expensive

      Here is the stack trace excerpt from the JFR capture which lead to this issue

      org.apache.log4j.spi.LoggingEvent.getLocationInformation()
      org.apache.log4j.helpers.PatternParser$ClassNamePatternConverter.getFullyQualifiedName(LoggingEvent)
      org.apache.log4j.helpers.PatternParser$NamedPatternConverter.convert(LoggingEvent)
      org.apache.log4j.helpers.PatternConverter.format(StringBuffer, LoggingEvent)
      org.apache.log4j.PatternLayout.format(LoggingEvent)
      org.apache.log4j.WriterAppender.subAppend(LoggingEvent)
      org.apache.log4j.RollingFileAppender.subAppend(LoggingEvent)
      ...
      org.apache.solr.update.processor.LogUpdateProcessorFactory$LogUpdateProcessor.finish()	214,658	32.42	0
      

      We could remove capturing the class name information from the default config but ideally capturing the classname is useful. So if we can find a way that doesn't need to create a throwable then it's ideal.

      Here is an interesting read : https://shipilev.net/blog/2014/exceptional-performance/

      Attachments

        Issue Links

          Activity

            People

              varun Varun Thacker
              varun Varun Thacker
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: