Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Compile-time signature

I'm using both AspectJ and Proguard in a project. On of my aspects
inserts MDC-information in logging messages, including source location
and method:

void around() : call(void org.slf4j.Logger.trace(..)) || call(void
org.slf4j.Logger.debug(..)) || call(void org.slf4j.Logger.info(..)) ||
call(void org.slf4j.Logger.warn(..)) || call(void
org.slf4j.Logger.error(..)) {
        try (MDC.MDCCloseable c3 =
MDC.putCloseable("logging_aspect::location",
thisJoinPoint.getSourceLocation().toString());
              MDC.MDCCloseable c4 =
MDC.putCloseable("logging_aspect::method",
thisEnclosingJoinPointStaticPart.getSignature().toString())) {
            proceed();
        }
    }

However, when enabling obfuscation in proguard, this results in log
messages like:

"mdc" : {
    "logging_aspect::method" : "void
java.lang.ClassNotFoundException.onCreateConnectionChannelResponse(ClassNotFoundException,
CreateConnectionChannelError, ConnectionStatus)",
    "logging_aspect::location" : "File.java:299"
}

I think there should be a way to access the Signature at the time of
compilation. This would also be faster (?) than looking up classes
during runtime.


Back to the top