[ 
https://issues.apache.org/jira/browse/SOLR-11901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16339596#comment-16339596
 ] 

Shalin Shekhar Mangar commented on SOLR-11901:
----------------------------------------------

I will be okay removing class name from production log4j properties but keeping 
it enabled in test logs. We can mostly follow logs using the messages 
themselves. If there are places that need better messages, then it'd be nice to 
improve them anyway. But I am curious if we pay the cost of creating the 
Throwable even if the particular logging level is disabled? If so, then it is a 
good argument to add checked logging everywhere.

> Improve how logging collects class name information
> ---------------------------------------------------
>
>                 Key: SOLR-11901
>                 URL: https://issues.apache.org/jira/browse/SOLR-11901
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Varun Thacker
>            Priority: Minor
>
> The log4j.properties that we ship with Solr has this Pattern
> {code}
> %d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} 
> %X{core}] %c{1.} %m%n
> {code}
> 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
> {code}
> 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
> {code}
> 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/



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to