Disable logging on the JAVA transport client


I'm trying to disable logging on the JAVA client, so I don't have the below outputting.

INFO: [Stone] modules [], plugins [], sites []
INFO: [Alchemy] modules [], plugins [], sites []

I've tried setting Log4jESLoggerFactory.getLogger("discovery").setLevel("WARN");

Is there a switch for this?


Turns out the below works


If you are using Log4J, you could also simply do that with some configuration.

Like add a log4j2.xml in your classpath:

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

This is what I'm doing here: https://github.com/dadoonet/legacy-search/blob/01-direct/src/main/resources/log4j2.xml