0

Hiberante generates many logs from itself (rather than my application code).e.g,

[main] WARN org.dbunit.dataset.AbstractTableMetaData - Potential problem found: The configured data type factory 'class o
June 21, 2015 12:57:03 δΈ‹εˆ org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}

If specifying print "WARN" log in slf4j.properites/log4s.properites, logging tools cannot distinguish which source(or component) generate the log?

How to remove these logs? Any help is appreciated

frogcdcn
  • 391
  • 1
  • 4
  • 14
  • Hibernate 4 has to be instructed to use slf4j/log4j (before Hibernate is used) via e.g. `System.setProperty("org.jboss.logging.provider", "slf4j");`. See also http://stackoverflow.com/a/19488546/3080094 – vanOekel Jun 21 '15 at 09:56

1 Answers1

0

All relevant logging frameworks allow you to specify the log level per logger(hierarchy). So you can set the log level for everything to INFO and for org.hibernate to ERROR.

See the documentation of your logging tool of choice on how to specify the log level.

In log4j.properties It would look similar to this:

log4j.rootLogger=INFO, A1
log4j.logger.org.hibernate=ERROR

log4j.appender.A1= ...
Jens Schauder
  • 77,657
  • 34
  • 181
  • 348