Apache BeanUtils.copyProperties 溢出太多日志
如何关闭 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通常,您可以单独配置每个类的日志记录级别。这在一定程度上取决于您使用的日志记录框架,但在日志记录配置文件中添加类似以下内容:
应限制该类中的记录器仅输出 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:
Should restrict the logger in that class to only output SEVERE logging statements.
You can also silence the entire package with
If you want more details, you'll have to provide more context.
如果您使用 log4j 您可以使用
更多详细信息
参见 log4j 手册
If you used log4j you can use
more details
see log4j manual
至于我在 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