Here are two approaches:
Setting the logging level to NONE should turn off all logging.
Since Hibernate uses the slf4j
facade, you should be able to use the NOPLogger
; see Get a dummy slf4j logger?.
Replace the log4j-core
dependency with this:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.30</version>
</dependency>
I've used this but its not working for me:
java.util.logging.Logger.getLogger("org.hibernate")
.setLevel(java.util.logging.Level.OFF);
Yea, that won't work. According the the dependency in your question, you have selected the log4j
as the backend. The code snippet above is configuring the java.util.logging
logger ...
Look at the javadocs for the log4j classes.