0

Sitecore Log example

I've been trying to diagnose some production websites and noticed that my Sitecore AppData logs are littered with Solr Queries INFO logging messages. Can these be turned off? I looked through all of my configuration files and /sitecore/admin/ShowConfig.aspx to see if there was a configuration setting, but I might be missing them.

I don't mind keeping these on our dev/staging CM servers, but it seems a little inefficient to log all of this on production unless it's on a case by case basis.

Does anyone have any recommendations on how to turn these off, or at least change the verbose level of these logs?

1
  • I don't think it would be accurate to say that the logs are riddled with Solr queries. This specific log file is designated for queries generated and sent to Solr. As you can see in the Sitecore configuration there are several loggers configured for different sources of information. Check the log4net section. Mar 29, 2023 at 15:06

2 Answers 2

4

Yes, you can control the logging level for Sitecore's interaction with Solr by modifying the configuration settings. To do this, you can create a patch configuration file to override the default settings.

Create a new patch file (e.g., DisableSolrQueryLogs.config) in the \App_Config\Include folder of your Sitecore instance.

Add the following content to the patch file:


<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"
               xmlns:role="http://www.sitecore.net/xmlconfig/role/">
  <sitecore>
    <log4net role:require="Standalone or ContentManagement">
      <logger name="Sitecore.Diagnostics.Search" additivity="false">
        <level value="WARN" />
        <appender-ref ref="LogFileAppender" />
      </logger>
    </log4net>
  </sitecore>
</configuration>

This configuration patch modifies the logger responsible for Solr query logs (Sitecore.Diagnostics.Search). By setting the logging level to WARN, you will disable INFO level messages, reducing the verbosity of the logs.

role:require="Standalone or ContentManagement" allows to apply this config only on both CM and Standalone servers.

Remember to restart the Sitecore instance or perform an IIS reset to apply the changes.

If you want to keep the INFO level logs on dev/staging environments, you can create a separate patch file with different logging levels for each environment and include the appropriate file in each environment's configuration.

Keep in mind that you may need to adjust the logger name depending on the Sitecore version you're using. For example, in Sitecore 9.3, the logger name might be Sitecore.ContentSearch.SolrProvider.SolrNetIntegration.DefaultSolrStartUp find the exact logger name for your version, check your existing log files or the Sitecore documentation.

1

You can control the logging level by applying the following patch. This will change the logging level from Info to Error.

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <log4net>
      <logger name="Sitecore.Diagnostics.Search" additivity="false">
        <level>
            <patch:attribute name="value">ERROR</patch:attribute>
        </level>
      </logger>
    </log4net>
  </sitecore>
</configuration>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.