我在控制台应用程序中使用 spring-instrument java 代理来进行加载时间编织。应用程序以这种方式启动:
java -javaagent:/path/spring-instrument-4.0.5.RELEASE.jar -classpath ... com.my.MainClass --argument
它工作正常,但它很好地在标准输出中打印了我想避免的这些补充消息:
[AppClassLoader@24dbf79d] info AspectJ Weaver Version 1.8.1 built on Saturday Jun 21, 2014 at 00:07:06 GMT
[AppClassLoader@24dbf79d] info register classloader sun.misc.Launcher$AppClassLoader@24dbf79d
[AppClassLoader@24dbf79d] info using configuration file:/path/my.jar!/META-INF/aop.xml
[AppClassLoader@24dbf79d] info register aspect org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect
[AppClassLoader@24dbf79d] info register aspect org.springframework.scheduling.aspectj.AnnotationAsyncExecutionAspect
[AppClassLoader@24dbf79d] info register aspect org.springframework.transaction.aspectj.AnnotationTransactionAspect
[AppClassLoader@24dbf79d] info register aspect org.springframework.cache.aspectj.AnnotationCacheAspect
我尝试在命令行选项中配置 log4j 级别,但似乎不起作用:
-Dlog4j.logger.org.aspectj=off
有什么建议吗?
最佳答案
我不知道Spring,但是AspectJ LTW。由于编织器似乎是相同的,我猜您也通过 META-INF/aop.xml
(或 META-INF/aop-ajc.xml
>,分别)。
也许你已经有了这样一个配置文件而不知道它,它说的是类似的内容
<weaver options="-verbose -showWeaveInfo">
如果是这样,只需删除附加选项即可。导致您引用的内容的是 -verbose
。另请参阅AspectJ LTW documentation .
关于java - 禁止来自 AppClassLoader 的日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25092855/