How to remove meaningless codes (HHH000 ...) from hibernation logs

I am trying a newer version of Hibernate (I have used 3.x so far) and Hibernate switched to jboss-logging for whatever reason. This is something I could easily live with, but I like to keep my logs clean and readable and insert codes into log messages:

16 Feb 2013 19:25:08,352 INFO  [Version:37] - HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
16 Feb 2013 19:25:08,357 INFO  [Version:41] - HHH000412: Hibernate Core {4.1.9.Final}
16 Feb 2013 19:25:08,358 INFO  [Environment:239] - HHH000206: hibernate.properties not found
16 Feb 2013 19:25:08,359 INFO  [Environment:342] - HHH000021: Bytecode provider name : javassist

      

I am using log4j as my log library and my pattern is

log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-5p [%c{1}:%L] - %m%n

      

and this suggests that the code is already part of the message that is being sent to log4j.

So, is there a way to remove codes from log messages so that

16 Feb 2013 19:25:08,357 INFO  [Version:41] - Hibernate Core {4.1.9.Final}

      

I don't want to completely disable hibernate logging, I just don't want to have codes like HHH000412 in it.

+3


source to share


1 answer


Refer to this to see the name of the log4j loggers used inside hibernation.

By configuring the log levels of these log4j loggers to different values, you can customize which messages are logged.



For example, log4j.logger.org.hibernate=OFF

to disable all hibernation recording. log4j.logger.org.hibernate=ERROR

will ERROR

log messages that have a level of at least (that is, INFO

no level log message will be output)

0


source







All Articles