Reputation: 177
How to log spring data generated solr query on console or in a file. I am using spring-data-solr version 2.0.6.RELEASE from spring boot version 1.4.3.RELEASE.
I am trying to log statements in file or console as we are able to do this in spring-data-jpa for sql statements.
Upvotes: 3
Views: 3291
Reputation: 6736
SolrTemplate
logs the created query string when executing the query. Enable logging eg. in logback.xml
by adding
<logger name="org.springframework.data.solr.core.SolrTemplate" level="DEBUG"/>
Which should give you something like:
2017-10-17 08:09:45,451 DEBUG o.s.d.solr.core.SolrTemplate: 504 - Executing query 'q={!join+from%3Dmanu_id_s+to%3Did}text:ipod' against solr.
2017-10-17 08:09:46,148 DEBUG o.s.d.solr.core.SolrTemplate: 504 - Executing query 'q=*:*&facet=true&facet.mincount=1&facet.limit=5&facet.field=name&facet.field=cat&facet.prefix=lan&f.name.facet.prefix=spr' against solr.
In case you're missing information in the logs please feel free to open an enhancement request in the bug tracker.
Upvotes: 10