[ 
https://issues.apache.org/jira/browse/SOLR-14349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Pugh resolved SOLR-14349.
------------------------------
    Resolution: Not A Problem

The upgrade side of this ticket has been done a long time ago...  However, the 
adoption of the Lambda pattern is something we need to discuss and adopt as a 
project and worht it's own Jira ;)

> Upgrade to slf4j 2x when available and encourage using lambdas for expensive 
> methods called in log statements.
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-14349
>                 URL: https://issues.apache.org/jira/browse/SOLR-14349
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Erick Erickson
>            Priority: Major
>
> Log4j2 already supports lazily-evaluated lambda expressions, but slf4j won't 
> support them until slf4j-2.0.0, see: 
> [https://jira.qos.ch/browse/SLF4J-371|https://jira.qos.ch/browse/SLF4J-371.]. 
> (thanks M. Drob for finding this!)
> Why it matters:
> A line like *log.trace("stuff {}", object.someMethod())* will execute 
> object.someMethod() regardless of the log level, leading to unnecessary work. 
> One example is SOLR-12353.
> Uwe Schindler pointed out that in the log4j2 context, constructs like: 
> *log.info("stuff {}", () -> object.someMethod(param))* are evaluated lazily, 
> i.e. the *object.comeMethod(param)* method is called if (and only if) the log 
> level includes "INFO".
> Until slf4j2.0 comes out, we'll handle these expensive calls on a 
> case-by-case basis, the simplest way is to wrap expensive calls in an if 
> clause, e.g.  *if (log.isTraceEnabled)* *\{log.trace....}*. Ugly, but it 
> works. Once we can upgrade to slf4j2.0, we should encourage using lambdas for 
> any expensive method call that's part of a log message.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to