休眠记录

问题描述

| 我有一个接口,希望Hibernate记录所有内容。 我的curernt配置是通过编程完成的,所以我没有任何hibernate.properties或hibernate.cfg.xml文件
configuration = new Configuration()  
.setProperty( \"hibernate.connection.driver_class\",\"org.postgresql.Driver\" )
.setProperty( \"hibernate.dialect\",\"org.hibernate.dialect.PostgresqlDialect\")
.setProperty( \"hibernate.connection.url\",\"jdbc:postgresql://****:5483/postgres\")
.setProperty( \"hibernate.connection.username\",\"****\")
.setProperty( \"hibernate.connection.password\",\"****\")
.setProperty( \"hibernate.c3p0.min_size\",\" 5\")
.setProperty( \"hibernate.c3p0.max_size\",\" 20\")
.setProperty( \"hibernate.c3p0.timeout\",\" 1800\")
.setProperty( \"hibernate.c3p0.max_statements\",\" 50\")
.setProperty( \"hibernate.connection.pool_size\",\"1\" )
.setProperty( \"hibernate.current_session_context_class\",\"thread\")
.setProperty( \"hibernatecache.provider_class\",\"org.hibernate.cache.NoCacheProvider\")
.setProperty( \"hibernate.show_sql\",\"true\" )
.addAnnotatedClass( ... )
.addAnnotatedClass( ... )
;
我有一个方法的日志记录界面
public void logLine( String line );
我怎么能够 1)指定要记录的内容 2)将日志重定向到接口?     

解决方法

        Hibernate正在将输出记录到标准输出。您将不得不以某种方式拦截它并重定向到您的日志记录机制。