Skip to content

Commit

Permalink
HSEARCH-4100 Use the TRACE level for query logs
Browse files Browse the repository at this point in the history
Signed-off-by: Yoann Rodière <yoann@hibernate.org>
  • Loading branch information
yrodiere authored and fax4ever committed Nov 9, 2020
1 parent dd4579c commit 3254067
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
Expand Up @@ -105,7 +105,7 @@ SearchException unexpectedIndexStatus(URLEncodedString indexName, String expecte
value = "Missing index: index aliases [%1$s, %2$s] do not point to any index in the Elasticsearch cluster." )
SearchException indexMissing(URLEncodedString write, URLEncodedString read);

@LogMessage(level = Level.DEBUG)
@LogMessage(level = Level.TRACE)
@Message(id = ID_OFFSET_LEGACY_ES + 53,
value = "Executing Elasticsearch query on '%s' with parameters '%s': <%s>" )
void executingElasticsearchQuery(String path, Map<String, String> parameters,
Expand Down
Expand Up @@ -126,7 +126,7 @@ public interface Log extends BasicLogger {
value = "Unable to parse '%1$ss' into a Lucene version: %2$s" )
SearchException illegalLuceneVersionFormat(String property, String luceneErrorMessage, @Cause Exception e);

@LogMessage(level = Level.DEBUG)
@LogMessage(level = TRACE)
@Message(id = ID_OFFSET_LEGACY_ENGINE + 274, value = "Executing Lucene query: %s" )
void executingLuceneQuery(Query luceneQuery);

Expand Down
8 changes: 8 additions & 0 deletions documentation/src/main/asciidoc/migration/index.asciidoc
Expand Up @@ -3372,3 +3372,11 @@ or right in the middle of other documents after a sort.

In Hibernate Search 6, a document whose field does not have a value always ends up at the very end by default.
This behavior link:{hibernateSearchDocUrl}#search-dsl-sort-common-missing[can be customized when defining the sort].

[[query-logging-trace]]
=== Logger `org.hibernate.search.query` uses the `TRACE` level

Hibernate Search logs all executed search queries to logger `org.hibernate.search.query`.

In Hibernate Search 5, these logs were at the `DEBUG` level.
In Hibernate Search 5, they are at the `TRACE` level.
Expand Up @@ -7,7 +7,7 @@
For search queries, you can get a human-readable representation of a <<search-dsl-query-object,`SearchQuery` object>>
by calling `toString()` or `queryString()`.
Alternatively, rely on the logs:
<<troubleshooting-logging-query,`org.hibernate.search.query`>> will log every query at the `DEBUG` level
<<troubleshooting-logging-query,`org.hibernate.search.query`>> will log every query at the `TRACE` level
before it is executed.

For more general information about what is being executed, rely on loggers:
Expand All @@ -25,7 +25,7 @@ Here are a few loggers that can be useful when debugging an application that use
[[troubleshooting-logging-query]]`org.hibernate.search.query`::
Available for all backends.
+
Logs every single search query at the `DEBUG` level, before its execution.
Logs every single search query at the `TRACE` level, before its execution.
[[troubleshooting-logging-elasticsearch-request]]`org.hibernate.search.elasticsearch.request`::
Available for Elasticsearch backends only.
+
Expand Down
Expand Up @@ -17,7 +17,7 @@ private DefaultLogCategories() {
}

/**
* Category for logging executed search queries.
* Category for logging executed search queries at the TRACE level.
*/
public static final LogCategory QUERY = new LogCategory( "org.hibernate.search.query" );

Expand Down

0 comments on commit 3254067

Please sign in to comment.