How to change Hibernate logging level?

371 views
Skip to first unread message

Tristan Miller

unread,
Apr 12, 2012, 8:20:05 AM4/12/12
to uby-...@googlegroups.com
Greetings.

When I start up an application using Uby I get several screenfuls of
useless INFO logging messages from Hibernate. How can I get rid of these?
I want only warnings or worse to be displayed.

I tried adding the following line to my application's log4j.properties file:

log4j.logger.org.hibernate = WARN

However, this has no effect. I turned on log4j debugging, which confirmed
that this line of the properties file is being read and successfully
applied. There's also no indication that any other log4j.properties is
being read in that might override this setting.

I've also tried adjusting the log level from within the program (via
Logger.getLogger("org.hibernate").setLevel(Level.WARN)) and disabling the
DBConfig's setShowSQL(), but these had no effect either.

Regards,
Tristan

--
Tristan Miller, Doctoral Researcher | Tel: +49 6151 16 6166
Ubiquitous Knowledge Processing Lab | Fax: +49 6151 16 5455
Department of Computer Science | mil...@ukp.informatik.tu-darmstadt.de
Technische Universität Darmstadt | http://www.ukp.tu-darmstadt.de/

signature.asc

Michael Matuschek

unread,
Apr 16, 2012, 10:06:49 AM4/16/12
to uby-...@googlegroups.com
This one's tricky. Hibernate uses slf4j for logging, and as I recently learned, the output verbosity is determined by the jars found in the class path/dependencies. Sounds weird, but let me explain:

The dependency that we ship the UBY API with is slf4j-simple, which just writes everything to the stdout. If you remove this dependency, you should get an error message that logging is not properly configured but otherwise you should be fine. If you add slf4j-nop you don't even get that, it stays completely quiet.

Now if you want to configure logging, you need a "proper" framework like log4j to do so (as you do in your environment anyway). For that, there are bridges like slf4j-log4 which do exactly that, but I'm not sure on the details as I haven't configured that for myself. As far as I understand messages are just passed on and log4j settings apply then, but don't shoot me if that doesn't work.

Best,

Michael
Reply all
Reply to author
Forward
0 new messages