禁止来自AppClassLoader的日志 [英] Suppressing logs from AppClassLoader

查看:125
本文介绍了禁止来自AppClassLoader的日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在控制台应用程序中使用spring-instrument java代理进行加载时编织.该应用程序以这种方式启动:

I'm using the spring-instrument java agent in a console application for load time weaving. The application starts up this way:

java -javaagent:/path/spring-instrument-4.0.5.RELEASE.jar -classpath ... com.my.MainClass --argument

它工作正常,但是很好地将这些补充消息打印在标准输出中,我想避免:

It's working fine, but it's nicely printing these complementary messages in the stdout that I'd like to avoid:

[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级别,但似乎不起作用:

I tried configure the log4j level in the command line options, but it seems not working:

-Dlog4j.logger.org.aspectj=off

有什么建议吗?

推荐答案

我不知道Spring,但是不知道AspectJ LTW.由于编织者似乎是相同的,我想您也可以通过META-INF/aop.xml(或分别为META-INF/aop-ajc.xml)以相同的方式配置它.

I do not know Spring, but AspectJ LTW. As the weaver seems to be the same, I guess you also configure it the same way via META-INF/aop.xml (or META-INF/aop-ajc.xml, respectively).

也许您已经有这样的配置文件,却不知道它,并且上面写着类似的内容

Maybe you already have such a config file without knowing about it and it says something like

<weaver options="-verbose -showWeaveInfo">

如果是这样,只需删除其他选项即可.引起您引用的原因是-verbose.另请参见 AspectJ LTW文档.

If so, just remove the additional options. The one causing what you have quoted is -verbose. See also AspectJ LTW documentation.

这篇关于禁止来自AppClassLoader的日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆