S
S
sanan :o2018-10-13 11:58:47
Java
sanan :o, 2018-10-13 11:58:47

How to disable logging in hibernate?

Hello everyone!
Please help me disable this garbage :(

окт 13, 2018 11:55:39 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.2.17.Final}
окт 13, 2018 11:55:39 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000205: Loaded properties from resource hibernate.properties: {hibernate.bytecode.use_reflection_optimizer=false}
окт 13, 2018 11:55:41 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
окт 13, 2018 11:55:41 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
окт 13, 2018 11:55:41 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [org.postgresql.Driver] at URL [jdbc:postgresql://localhost/app]
окт 13, 2018 11:55:41 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {user=postgres, password=****}
окт 13, 2018 11:55:41 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
окт 13, 2018 11:55:41 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
окт 13, 2018 11:55:41 AM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL9Dialect
окт 13, 2018 11:55:41 AM org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl useContextualLobCreation
INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
окт 13, 2018 11:55:41 AM org.hibernate.type.BasicTypeRegistry register
INFO: HHH000270: Type registration [java.util.UUID] overrides previous : [email protected]
окт 13, 2018 11:55:41 AM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection

And further in this spirit... kapets interferes. Googled and didn't find a solution.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Cheypnow, 2018-10-13
@Cheypnow

log4j.logger.org.hibernate=info
In XML

<logger name="org.hibernate">
  <level value="info"/> 
</logger>

S
Sanan :o, 2018-10-18
@sanantech

in general, I did the following:
I created a file in src/main/resources/log4j.properties with the following content

log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=/home/sanan/logs/log4j.log
log4j.appender.file.MaxFileSize=1MB
log4j.appender.file.MaxBackupIndex=1
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

# Root logger option
log4j.rootLogger=FATAL, file

# Log everything. Good for troubleshooting
log4j.logger.org.hibernate=FATAL

# Log all JDBC parameters
log4j.logger.org.hibernate.type=ERROR

in the pom.xml file in dependencies added:
<dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>1.6.1</version>
    </dependency>

everything worked, but of course, only when launched via maven

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question