How to disable log info level message for neo4j java driver?

I am getting unwanted log info message from neo4j java driver like following

févr. 14, 2020 7:03:19 PM org.neo4j.driver.internal.logging.JULogger info
INFOS: Closing driver instance 848409667
févr. 14, 2020 7:03:19 PM org.neo4j.driver.internal.logging.JULogger info
INFOS: Closing connection pool towards localhost:7687

How can I suppress log INFO message? Or how can I set level to WARN for neo4j java driver logging?

If you are using slf4j logging and have log4j properties file in your project you could add this to it.

log4j.logger.org.neo4j=WARN,STDOUT

Alternatively you can create the driver with explicit config

Driver driver = GraphDatabase.driver("bolt://localhost:7687",
                                         AuthTokens.basic("neo4j", "password"),
                                         Config.build().withLogging(Logging.javaUtilLogging(Level.WARNING)).toConfig());

This created driver with that level that uses Java utility debugging.

Hi,

I use neo4j-java-driver V 4.0.0

import org.neo4j.driver.Config;
import org.neo4j.driver.Logging;
this.neo4jDriver = GraphDatabase.driver(
   uri, 
   AuthTokens.basic(this.user, this.password),
   Config.build().withLogging(Logging.javaUtilLogging(Level.WARNING)).toConfig()
);

I got this lint error:

The method build() is undefined for the type ConfigJava

Following the message Feb 14, 2020 7:03:19 PM org.neo4j.driver.internal.logging.JULogger info, neo4j driver seems to use by default Java Logging API (JUL) and not SLF4J logging

The following worked for me with Neo4J 4.0.3 and the Java Driver 4.0.1

Config config = Config.builder().withLogging(new JULogging(Level.WARNING)).build()
Driver driver = GraphDatabase.driver(boltURL, AuthTokens.basic(username, password), config)

Hopefully this will help someone else as well.