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

Chris M. Hostetter commented on SOLR-16044:
-------------------------------------------

Jan's comment / question to me is refering to SOLR-16772.

I don't have strong feelings about adding a new sysprop for the level of 
SolrCore's logger (or specifically for  SolrCore.Request or 
SolrCore.SlowRequest) ... i just know that if we want to add any more "this 
special solr sys prop will change your logging" features it should be done via 
existing log4j2.xml config options, and not "runtime code" that goes and mucks 
with loggers people may have already configurd how they want.

----

all of which is tangential to this bug BTW...

 

The problem you're seeing here has nothing to do with if/how the 
SolrCore.SlowRequest logger inheits things from SolrCore logger, or wether 
SlowRequest is a "real class (log4j doesn't know/care about that).

The reason SlowRequest logger doesn't work if SolrCore is set to ERROR is 
becuase of a bug going all the way back to SOLR-11453 when the SlowRequest 
logger was added (instead of the SolrCore logger being used directly) so that 
those messages could be routed to a custom log file...

 
{code:java}
       /* slowQueryThresholdMillis defaults to -1 in SolrConfig -- not 
enabled.*/
      if (log.isWarnEnabled() && slowQueryThresholdMillis >= 0) {
{code}
 

...should be...
{code:java}
       /* slowQueryThresholdMillis defaults to -1 in SolrConfig -- not 
enabled.*/
      if (slowLog.isWarnEnabled() && slowQueryThresholdMillis >= 0) {
{code}
 

ie: we're asking the wrong logger "is this log level enabled?"

> SlowRequest logging disabled if SolrCore logger set to ERROR
> ------------------------------------------------------------
>
>                 Key: SOLR-16044
>                 URL: https://issues.apache.org/jira/browse/SOLR-16044
>             Project: Solr
>          Issue Type: Bug
>          Components: logging
>         Environment: Solr 8.4
>            Reporter: Jan Høydahl
>            Priority: Major
>
> If someone sets ROOT logger to ERROR, then {{SolrCore}} class will also be 
> set to ERROR, and even if {{SolrCore.SlowRequest}} level is set to INFO, no 
> logs will be written to {{{}solr_slow_requests.log{}}}.
> Some debugging revealed that changing log level of {{SolrCore}} to WARN fixes 
> it. This suggests that since {{SlowRequest}} is not a real class but just a 
> logger name, it is still subject to the log level of {{SolrCore}}.
> I suppose that the same will be true for {{SolrCore.Request}} logging.
> One solution could be to create a real class for SlowRequest logging. Another 
> solution could be to explicitly set {{SolrCore}} level in {{log4j2.xml}} so 
> that it does not follow the ROOT level.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to