mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 17:34:17 -04:00
Add Logback config to java REST client docs (#94358)
This commit is contained in:
parent
40f1d44194
commit
7c342f1241
1 changed files with 34 additions and 0 deletions
|
@ -420,3 +420,37 @@ still yields the same response as it did. Enable trace logging for the `tracer`
|
||||||
package to have such log lines printed out. Do note that this type of logging is
|
package to have such log lines printed out. Do note that this type of logging is
|
||||||
expensive and should not be enabled at all times in production environments,
|
expensive and should not be enabled at all times in production environments,
|
||||||
but rather temporarily used only when needed.
|
but rather temporarily used only when needed.
|
||||||
|
|
||||||
|
==== Logback
|
||||||
|
===== Trace Logs
|
||||||
|
In order to enable trace logs for logback, we have to use https://www.slf4j.org/legacy.html#jclOverSLF4J[jcl-over-slf4j bridging module].
|
||||||
|
|
||||||
|
1. Add the following to your Gradle setting:
|
||||||
|
[source,groovy]
|
||||||
|
dependencies {
|
||||||
|
implementation('org.slf4j:slf4j-api:1.8.0-beta2')
|
||||||
|
implementation('ch.qos.logback:logback-classic:1.3.0-alpha4')
|
||||||
|
implementation('org.slf4j:jcl-over-slf4j:1.8.0-beta2')
|
||||||
|
}
|
||||||
|
|
||||||
|
2. Exclude `commons-logging.jar`:
|
||||||
|
[source,groovy]
|
||||||
|
dependencies {
|
||||||
|
configurations.all {
|
||||||
|
exclude group: "commons-logging", module: "commons-logging"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
3. Add a tracer logger in Logback configuration:
|
||||||
|
[source,xml]
|
||||||
|
<logger name="tracer" level="TRACE" additivity="false">
|
||||||
|
<appender-ref ref="your_appender_block_name" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
===== RestClient Debug Logs
|
||||||
|
To enable debug logs for `RestClient` class, add the following to your Logback configuration:
|
||||||
|
[source,xml]
|
||||||
|
<logger name="org.elasticsearch.client.RestClient" level="DEBUG" additivity="false">
|
||||||
|
<appender-ref ref="your_appender_block_name" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue