Apache BeanUtils.copyProperties 溢出太多日志

发布于 2024-08-25 19:50:32 字数 488 浏览 7 评论 0原文

如何关闭 BeanUtils.copyProperties 的日志记录?它会创建太多日志并妨碍日志文件的可读性。谢谢堆..

示例代码

BeanUtils.copyProperties(someDataobject,someActionForm);

在日志中我看到数百行,如下所示

EBUG org.apache.commons.beanutils.PropertyUtils - setSimpleProperty:
调用值为 null (class ) 的方法 public void someMethod(java.lang.String)
2010-03-23 18:53:23,134 调试 org.apache.commons.beanutils.BeanUtils - copyProperty(someActionForm@13e38a7, someValue,)

How can I switch off logging for BeanUtils.copyProperties ? It creates way too much logs and hampers the log file readability. Thanks heaps..

Sample code

BeanUtils.copyProperties(someDataobject,someActionForm);

In the log I see hunders of lines like below

EBUG org.apache.commons.beanutils.PropertyUtils - setSimpleProperty:
Invoking method public void someMethod(java.lang.String) with value null (class )
2010-03-23 18:53:23,134 DEBUG org.apache.commons.beanutils.BeanUtils - copyProperty(someActionForm@13e38a7, someValue, )

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

笙痞 2024-09-01 19:50:32

通常,您可以单独配置每个类的日志记录级别。这在一定程度上取决于您使用的日志记录框架,但在日志记录配置文件中添加类似以下内容:

org.apache.commons.beanutils.PropertyUtils.level=SEVERE

应限制该类中的记录器仅输出 SEVERE 日志记录语句。

来使整个包静音。

org.apache.commons.beanutils.level=SEVERE

您还可以使用“如果您想要更多详细信息,则必须提供更多上下文”

Typically you can configure the logging level of each class individually. This depends a bit on which logging framework you are using but adding something like the following to your logging configuration file:

org.apache.commons.beanutils.PropertyUtils.level=SEVERE

Should restrict the logger in that class to only output SEVERE logging statements.

You can also silence the entire package with

org.apache.commons.beanutils.level=SEVERE

If you want more details, you'll have to provide more context.

百思不得你姐 2024-09-01 19:50:32

如果您使用 log4j 您可以使用

log4j.logger.org.apache.commons.beanutils=ERROR

更多详细信息
参见 log4j 手册

If you used log4j you can use

log4j.logger.org.apache.commons.beanutils=ERROR

more details
see log4j manual

谜兔 2024-09-01 19:50:32

至于我在 Spring Boot 项目中使用 Commons BeanUtils,我发现工作解决方案是 JCL-over-SLF4J 替换,如以下链接所示:
在 Spring 中记录依赖项

As for me using Commons BeanUtils in Spring Boot project, I found working solution to be JCL-over-SLF4J replacement, as in this link:
Logging Dependencies in Spring

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文