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

Fix side effect of logging call in LogUpdateProcessorFactory

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Invalid
    • 7.5
    • None
    • logging
    • None

    Description

      This section of code:

            if (log.isInfoEnabled()) {
              log.info(getLogStringAndClearRspToLog());
            }
      
            if (log.isWarnEnabled() && slowUpdateThresholdMillis >= 0) {
              final long elapsed = (long) req.getRequestTimer().getTime();
              if (elapsed >= slowUpdateThresholdMillis) {
                log.warn("slow: " + getLogStringAndClearRspToLog());
              }
            }
      

      is wrong since getLogStringAndClearRspToLog() contains this bit:

            rsp.getToLog().clear();   // make it so SolrCore.exec won't log this again
      

      so the second call, if both are executed, has already cleared the rsp.toLog.

      Besides it's poor form to have this kind of side-effect in a logging call.

      I'll fix soon, now that I'm not in a panic thinking I introduced this with the logging bits I did recently, this has been around since 7.5

      Attachments

        Activity

          People

            erickerickson Erick Erickson
            erickerickson Erick Erickson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: