0

By default, hbm2ddl spits a ton of output to the console when executing the ant task. I'd like to turn this completely off and simply look at the schema file if something has gone wrong. Anyone know how to do that?

Tim Visher
  • 12,786
  • 16
  • 58
  • 66

2 Answers2

4

Hibernate (at least the current version) uses SLF4J for logging. Use the SLF4J NOP to silently discarding all logging. Alternatively you could configure a low level verbosity for your logging framework (e.g. log4j).

A sample log4j.properties:

### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

log4j.rootLogger=warn, stdout
log4j.logger.org.hibernate=debug
log4j.logger.org.hibernate.tool.hbm2ddl=debug
Markus Knittig
  • 631
  • 5
  • 8
  • Could you update this with a snippet example? Other than that, this is exactly what I was looking for. Thanks. – Tim Visher Apr 12 '10 at 19:02
2

There is undocumented property which should be defined in task:

<hibernatetool ....>

   <property key="scriptToConsole" value="false"/>

...

   <hbm2ddl ....../>

</hibernatetool>

For me it works!

GregAngel
  • 31
  • 2