Configure Solr query logging

Version: 10.4

This logging feature lets you track Solr queries in xConnect logs. It is disabled by default.

Enable Solr query logging

To enable Solr query logging:

  • Enable the file \App_Data\Config\Sitecore\CollectionSearch\sc.Xdb.Collection.IndexReader.SOLR.Logging.xml.disabled by renaming the file to \App_Data\Config\Sitecore\CollectionSearch\sc.Xdb.Collection.IndexReader.SOLR.Logging.xml.

Solr query log output example

The Solr query log output contains log entries for each query. Log records consist of the query transcript and the sorting used. For example:

RequestResponse
2021-05-31 20:59:49.703 +03:00 [Verbose] Executing SOLR query 
{ 
  "query": "(x_type_s:(\"ContactDataRecord\") AND lastmodified_dt:[* TO \"2021\\-05\\-31T17\\:59\\:49.6847180Z\"])", 
  "sort": "id asc" 
} 
 
2021-05-31 20:59:51.212 +03:00 [Verbose] Executing SOLR query 
{ 
  "query": "(x_type_s:(\"ContactDataRecord\") AND *:*)", 
  "sort": "id asc" 
} 
 
2021-05-31 21:00:30.518 +03:00 [Verbose] Executing SOLR query 
{ 
  "query": "(x_type_s:(\"ContactDataRecord\") AND (facets.addresses.preferredkey_s:(\"Work\") OR (_query_:(\"\\{\\!type=parent which=x_type_s\\:\\(\\\"ContactDataRecord\\\"\\)\\}\\(path_s\\:\\(\\\"Facets.Addresses.Others\\\"\\) AND value.city_s\\:\\(\\\"Dniprobd15759b\\\\\\-e439\\\\\\-47f7\\\\\\-9d33\\\\\\-1787d9027530\\\"\\)\\)\") AND _query_:(\"\\{\\!type=parent which=x_type_s\\:\\(\\\"ContactDataRecord\\\"\\)\\}\\(path_s\\:\\(\\\"Facets.Addresses.Others\\\"\\) AND value.postalcode_s\\:\\(\\\"49000bd15759b\\\\\\-e439\\\\\\-47f7\\\\\\-9d33\\\\\\-1787d9027530\\\"\\)\\)\"))))", 
  "sort": "id asc" 
} 
 
2021-05-31 21:00:30.612 +03:00 [Verbose] Executing SOLR query 
{ 
  "query": "(x_type_s:(\"ContactDataRecord\") AND (facets.addresses.preferredkey_s:(\"Work\") OR (_query_:(\"\\{\\!type=parent which=x_type_s\\:\\(\\\"ContactDataRecord\\\"\\)\\}\\(path_s\\:\\(\\\"Facets.Addresses.Others\\\"\\) AND value.city_s\\:\\(\\\"Dniprobd15759b\\\\\\-e439\\\\\\-47f7\\\\\\-9d33\\\\\\-1787d9027530\\\"\\)\\)\") AND _query_:(\"\\{\\!type=parent which=x_type_s\\:\\(\\\"ContactDataRecord\\\"\\)\\}\\(path_s\\:\\(\\\"Facets.Addresses.Others\\\"\\) AND value.postalcode_s\\:\\(\\\"49000bd15759b\\\\\\-e439\\\\\\-47f7\\\\\\-9d33\\\\\\-1787d9027530\\\"\\)\\)\"))))", 
  "sort": "id asc" 
} 

Change the log level

You can configure the log level for Solr query logging. The extended XConnect Solr query log entry level is Trace by default.

To change the log level:

  • Open the config file \App_Data\Config\Sitecore\CollectionSearch\sc.Xdb.Collection.IndexReader.SOLR.Logging.xml and modify the value of the Settings/Sitecore/XConnect/CollectionSearch/Services/Solr.SolrReaderSettings/Options/ExtendedLogLevel node to Trace, Debug, or Information.

    RequestResponse
    <ExtendedLogLevel>Trace</ExtendedLogLevel>

Do you have some feedback for us?

If you have suggestions for improving this article,