# ES 6.4: Java RestClient and log4j2

**URL:** <https://discuss.elastic.co/t/es-6-4-java-restclient-and-log4j2/150838>\
**Category:** Elasticsearch\
**Created:** [October 3, 2018, 7:50am UTC](https://discuss.elastic.co/t/es-6-4-java-restclient-and-log4j2/150838 "2018-10-03T07:50:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LGans316](https://avatars.discourse-cdn.com/v4/letter/l/cab0a1/32.png) [@LGans316](https://discuss.elastic.co/u/LGans316)\
**Post date:** [October 3, 2018, 7:50am UTC](https://discuss.elastic.co/t/es-6-4-java-restclient-and-log4j2/150838/1 "2018-10-03T07:50:40Z")

</div>

**src/main/resources/log4j2.xml**

```
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info" monitorInterval="60">
	<Appenders>
		<Console name="Console" target="SYSTEM_OUT">
			<PatternLayout pattern="%d{HH:mm:ss.SSS} [%-5level] %C{1.} - %msg%n" />
		</Console>
	</Appenders>
	<Loggers>
        <Logger name="org.elasticsearch" level="warn"/>
        <Logger name="org.apache" level="warn" />
	     <Root level="info">
		    <AppenderRef ref="Console" />
	     </Root>
	</Loggers>
</Configuration>

```

**Console output**

Despite setting log level to warn/error, I keep getting these DEBUG messages. This is impacting the performance. This log4j2.xml is corrected loaded as my Class logger that uses it works fine.

```
08:42:07.197 [main] DEBUG org.apache.http.impl.nio.client.MainClientExec - [exchange: 1] start execution
08:42:07.209 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
08:42:07.224 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Re-using cached 'basic' auth scheme for http://xxx.uk.db.com:9200
08:42:07.224 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - No credentials for preemptive authentication
08:42:07.224 [main] DEBUG org.apache.http.impl.nio.client.InternalHttpAsyncClient - [exchange: 1] Request connection for {}->http://xxx.uk.db.com:9200
08:42:07.226 [main] DEBUG org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager - Connection request: [route: {}->http://xxx.uk.db.com:9200][total kept alive: 0; route allocated: 0 of 10; total allocated: 0 of 30]
08:42:07.252 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager - Connection leased: [id: http-outgoing-0]
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 31, 2018, 7:50am UTC](https://discuss.elastic.co/t/es-6-4-java-restclient-and-log4j2/150838/2 "2018-10-31T07:50:44Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
