Remove these logs from Hibernate?

0

I'm doing a Java program with Hibernate, and these logs really bother me a lot. Does anyone know how to remove them? The letters in red.

    
asked by Pablo González 03.06.2018 в 00:39
source

1 answer

1

Hibernate uses JBoss Logging , what it does is pass the management of the logs to another library, as they are in the classpath .

As I suppose you have not put any, that means that you just pass the logs to the logging system of the JDK, which is what you have to configure.

There are several ways to configure the logging of the JDK:

  • Via program, "resetting" the handlers :

    LogManager.getLogManager().reset();
    Logger globalLogger = Logger.getLogger(java.util.logging.Logger.GLOBAL_LOGGER_NAME);
    globalLogger.setLevel(java.util.logging.Level.OFF);
    
  • Using a configuration file , a text file such that:

      

    handlers = java.util.logging.ConsoleHandler

         

    config =

         

    org.hibernate.handlers = java.util.logging.ConsoleHandler

         

    org.hibernate.useParentHandlers = false

         

    org.hibernate.level = OFF

    This says that all logs sent to org.hibernate are disabled.

    To use this configuration, you have to define the java.util.logging.config.file property with the file path; this is done by passing a -Djava.util.logging.config.file=[rutal fichero conf] parameter when invoking the JVM.

answered by 03.06.2018 / 04:20
source