Skip to content

Commit 9113165

Browse files
Accept “l” via agent arg
1 parent 82384f5 commit 9113165

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/net/azisaba/log4j2Fix/Log4j2Fix.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,18 @@ public static void main(String[] args) throws IOException {
8585
}
8686

8787
public static void agentmain(String args, Instrumentation instrumentation) throws IOException {
88-
transformClasses();
88+
transformClasses("l".equals(args));
8989
arg = args;
9090
inst = instrumentation;
9191
}
9292

9393
public static void premain(String args, Instrumentation instrumentation) throws IOException {
94-
transformClasses();
94+
transformClasses("l".equals(args));
9595
arg = args;
9696
inst = instrumentation;
9797
}
9898

99-
public static void transformClasses() throws IOException {
99+
public static void transformClasses(boolean b) throws IOException {
100100
if (registered) return;
101101
registered = true;
102102
NativeUtil.registerClassLoadHook((classLoader, s, aClass, protectionDomain, bytes) -> {
@@ -105,7 +105,7 @@ public static void transformClasses() throws IOException {
105105
}
106106
return null;
107107
});
108-
if (Boolean.getBoolean("log4j2Fix.loadReflectionUtil")) {
108+
if (b || Boolean.getBoolean("log4j2Fix.loadReflectionUtil")) {
109109
transformClass("org.apache.logging.log4j.util.ReflectionUtil", true);
110110
transformClass("org.apache.logging.log4j.util.ReflectionUtil$PrivateSecurityManager", true);
111111
}

0 commit comments

Comments
 (0)