开发者

Apache BeanUtils.copyProperties is spilling too much log

开发者 https://www.devze.com 2022-12-24 14:31 出处:网络
How can I switch off logging for BeanUtils.copyProperties ? It creates way too much logs and hampers the log file readability. Thanks heaps..

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, )


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.


If you used log4j you can use

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

more details see log4j manual


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

0

精彩评论

暂无评论...
验证码 换一张
取 消