1

I am using JPA 2.1 and it keeps generating useless logs as below every time there is an operation on db. It gets printed out on console in red when debugging, but will output to stderr when I run the program in command line.

Jun 09, 2016 2:18:11 PM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
        name: RIStore_Flow
        ...]
Jun 09, 2016 2:18:11 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.1.0.Final}
Jun 09, 2016 2:18:11 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Jun 09, 2016 2:18:11 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Jun 09, 2016 2:18:11 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
Jun 09, 2016 2:18:13 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
Jun 09, 2016 2:18:13 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [oracle.jdbc.OracleDriver] at URL 
Jun 09, 2016 2:18:13 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {user=ristore_owner, password=****}
Jun 09, 2016 2:18:13 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
Jun 09, 2016 2:18:13 PM org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
Jun 09, 2016 2:18:14 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
Jun 09, 2016 2:18:14 PM org.hibernate.hql.internal.QueryTranslatorFactoryInitiator initiateService
INFO: HHH000397: Using ASTQueryTranslatorFactory
Jun 09, 2016 2:18:15 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop
INFO: HHH10001008: Cleaning up connection pool [jdbc:oracle:thin:@ldap://mdaoid.mdanderson.org:389/risdev3, cn=OracleContext,dc=mdacc,dc=tmc,dc=edu]
Jun 09, 2016 2:18:15 PM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [

Since I am not using log4j to the logging, I don't think solution to this problem would help. By looking at the first line of the output, seems it is using org.hibernate.jpa.internal.util.LogHelper for logs. Is there something I can set in persistence.xml to turn off this kind of logs?

EDIT: I just noticed this login.properties file under my project, don't know when and how it is generated. But in that file there is some configuration about logging under eclipselink.logging. Should I change eclipselink.logging.level from FINE to SEVERE?

#Tue May 24 10:25:11 CDT 2016
javax.persistence.jdbc.url=
eclipselink.logging.session=false
eclipselink.logging.level=FINE
eclipselink.ddl-generation=drop-and-create-tables
eclipselink.logging.timestamp=false
eclipselink.logging.thread=false
eclipselink.ddl-generation.output-mode=database
eclipselink.logging.exceptions=true
Community
  • 1
  • 1
ddd
  • 4,665
  • 14
  • 69
  • 125
  • JPA does not define logging, your JPA provider, in this case Hibernate does. EclipseLink is an alternate JPA provider, so changing those setting wont help - you will need to read the docs for Hibernate to set its logging, similar to this question http://stackoverflow.com/questions/4362876/how-to-view-the-sql-queries-issued-by-jpa – Chris Jun 14 '16 at 19:48
  • @Chris I have `hibernate.show_sql=false` in my `persistence.xml` and it did seem to turn off sql statements. However the output that starts with `INFO` has nothing to do with sql. Like I mentioned I do have `eclipselink.logging.level=FINE` in my `login.properties`, it did not change anything after I changed that line to `eclipselink.logging.level=SEVERE`. – ddd Jun 15 '16 at 02:22
  • Did you check for other configuration files, such as the log4j properties? I doubt Hibernate logs at the INFO level by default, so you must have turned it on somehow. As mentioned, EclipseLink log settings won't make a difference unless you are using EclipseLink as your JPA provider. But the file itself seems like this project was intended to log at the FINE level, so you'll need to look into your project more. – Chris Jun 15 '16 at 13:53
  • @Chris Like I said, I am not using log4j. So I don't have log4j.properties in my project. Is log4j another log controller? If I use it, essentially I would switch logging controller from Hibernate to log4j? – ddd Jun 16 '16 at 13:26
  • The fact you have a login.properties that contains what seem to be persistence unit properties for EclipseLink that normally go in a persistence.xml has be suspecting your application is not configuring JPA with a simple persistence.xml file, and instead passing overrides when it initializes JPA. You need to look at your application and see how it works and is configuring Hibernate, and that will give you clues to why it is logging what it is. http://stackoverflow.com/a/27482790/496099 might help – Chris Jun 16 '16 at 15:13

1 Answers1

0

You can just use eclipselink.logging.level=OFF to disable logging

As mentioned here https://www.eclipse.org/eclipselink/documentation/2.5/jpa/extensions/p_logging_level.htm

Bhupendra
  • 1
  • 3