You can write your own logging agent class, and then use the java.lang.instrument package for bytecode injection. You can use javassist for injection, which is simple and easy to use. It is equivalent to AOP at the JVM layer.
Generally third-party jars have log implementation, which may use commons-logging or slf4j interface. For example, if slf4j is used to implement logback, then it is generally sufficient to add slf4j and logback jars to the project. To change the log implementation method, use log Bridge package. If the requirements cannot be met, you can use jd-dui to decompile and jbe to modify the bytecode
I just found a tool, anylog, which seems to work, but I haven’t tried it yet, but it would be best to implement it through code. I’m still looking for a way
You can write your own logging agent class, and then use the java.lang.instrument package for bytecode injection. You can use javassist for injection, which is simple and easy to use. It is equivalent to AOP at the JVM layer.
It depends on how you use it. If you use it
bean
对象被ioc
容器管理着那一定可以使用aop
Generally third-party jars have log implementation, which may use commons-logging or slf4j interface. For example, if slf4j is used to implement logback, then it is generally sufficient to add slf4j and logback jars to the project. To change the log implementation method, use log Bridge package.
If the requirements cannot be met, you can use jd-dui to decompile and jbe to modify the bytecode
I just found a tool, anylog, which seems to work, but I haven’t tried it yet, but it would be best to implement it through code. I’m still looking for a way