问题
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
I tried configure the log4j level in the command line options, but it seems not working:
-Dlog4j.logger.org.aspectj=off
Any suggestions?
回答1:
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">
If so, just remove the additional options. The one causing what you have quoted is -verbose
. See also AspectJ LTW documentation.
来源:https://stackoverflow.com/questions/25092855/suppressing-logs-from-appclassloader