Hibernate似乎正在将正常信息记录到System.err
。一些例子是:
System.err: Sep 03, 2013 10:41:55 AM org.hibernate.annotations.common.Version <clinit>
System.err: Sep 03, 2013 10:41:55 AM org.hibernate.Version logVersion
System.err: Sep 03, 2013 10:41:55 AM org.hibernate.cfg.Environment <clinit>
System.err: Sep 03, 2013 10:41:55 AM org.hibernate.cfg.Environment buildBytecodeProvider
System.err: Sep 03, 2013 10:42:02 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
总共约有70个。我的日志设置如下:
log4j-over-slf4j.jar
slf4j-api.jar
slf4j-simple-1.7.5.jar
我知道slf4j-simple,per the SLF4J Manual,"outputs all events to System.err. Only messages of level INFO and higher are printed."
了解这一点,我将org.slf4j.simpleLogger.logFile
系统属性设置为System.out
specified in the SimpleLogger docs。
然而,这并未改变任何行为,而且我仍然获得了70多个Hibernate System.err日志。
有没有办法将Hibernate配置为不输出到System.err
?问题是这些System.err
消息被解释为WARN,而它们只是信息性消息。
答案 0 :(得分:0)
现在Hibernate 4.x使用JBoss进行日志记录,这导致了问题。 This thread帮助最多,解决方案是设置系统属性org.jboss.logging.provider=slf4j
。
这使slf4j-simple
能够获取所有Hibernate System.err
输出。使用原始线程中提到的系统属性,您可以将System.err
输出更改为System.out
。