如何打开休眠验证器DEBUG记录器

如何打开休眠验证器DEBUG记录器

本文介绍了如何打开休眠验证器DEBUG记录器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将hibernate-validator(6.0.9.Final)添加到我的spring(不是spring boot)maven项目中,并且可以正常工作,但是会导致大量(〜3000行)DEBUG日志.如何关闭此日志?

I add hibernate-validator(6.0.9.Final) to my spring (not spring boot) maven project and work perfectly, but cause lot of(~3000 row) DEBUG log. How to off this log?

我尝试了这些,但是没有用:

I tried these, but didn't work:

logging.level.org.hibernate=info
log4j.logger.org.hibernate=info

推荐答案

(默认情况下)Hibernate Validator的日志级别(显然)不是DEBUG,因此您必须在应用程序类路径中包含一些将日志级别设置为DEBUG的东西.

The log level of Hibernate Validator is (obviously) not DEBUG by default so you must have something in your application classpath setting the log level to DEBUG.

Hibernate Validator正在使用JBoss Logging,该日志在后台使用了log4j,因此log4j.properties中的 log4j.logger.org.hibernate.validator = info 应该可以工作.

Hibernate Validator is using JBoss Logging which uses log4j under the hood so log4j.logger.org.hibernate.validator=info in your log4j.properties should work.

但是考虑到最初不应该将其设置为DEBUG,我想知道您的类路径中是否有某些内容可以覆盖日志配置.

But considering it shouldn't have been set to DEBUG in the first place, I'm wondering if you have something in your classpath overriding your log configuration.

我怀疑您或依赖项已为org.hibernate启用了DEBUG日志以查看查询或类似内容,这是您应该找到并删除的设置.

I suspect either you or a dependency have enabled DEBUG logging for org.hibernate to see the queries or something similar and this is this setting you should find and remove.

这篇关于如何打开休眠验证器DEBUG记录器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 13:11