如何过滤掉 Hibernate 日志条目

How to filter out Hibernate log entries

我正在使用 hibernate 3.5.0-* 并且我得到了很多日志条目(在我的标准输出上),我想删除它们。

我不知道它来自哪里,但我怀疑 Hibernate 可能负责生成它。

看起来像:

> orderByFragment(order-by)
  > sortSpecification({sort specification})
   > sortKeySpecification(sort key)
    > sortKey($PlaceHolder$.lastname)
    < sortKey(null)
   < sortKeySpecification(asc)
   > orderingSpecification(asc)
   < orderingSpecification(null)
  < sortSpecification(null)
...

有人知道它来自哪里以及如何删除它吗?

那是因为您设置了默认的 TRACE 日志级别。

尝试将其设置为 WARN:

  • Logback/Log4j2

    <logger name="org.hibernate" level="warn"/>
    
  • Log4j

    <logger name="org.hibernate">
       <level value="warn"/> 
    </logger>