mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-17 23:01:01 +01:00
Fix stacktrace deobf where thrownProxy got initialized before rewriting (#6684)
This commit is contained in:
parent
e3ec51968c
commit
019c768488
2 changed files with 15 additions and 17 deletions
|
@ -132,7 +132,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+import org.apache.logging.log4j.core.appender.rewrite.RewritePolicy;
|
+import org.apache.logging.log4j.core.appender.rewrite.RewritePolicy;
|
||||||
+import org.apache.logging.log4j.core.config.plugins.Plugin;
|
+import org.apache.logging.log4j.core.config.plugins.Plugin;
|
||||||
+import org.apache.logging.log4j.core.config.plugins.PluginFactory;
|
+import org.apache.logging.log4j.core.config.plugins.PluginFactory;
|
||||||
+import org.jetbrains.annotations.NotNull;
|
+import org.apache.logging.log4j.core.impl.Log4jLogEvent;
|
||||||
|
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
+
|
+
|
||||||
+@Plugin(
|
+@Plugin(
|
||||||
+ name = "StacktraceDeobfuscatingRewritePolicy",
|
+ name = "StacktraceDeobfuscatingRewritePolicy",
|
||||||
|
@ -141,17 +142,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ printObject = true
|
+ printObject = true
|
||||||
+)
|
+)
|
||||||
+public final class StacktraceDeobfuscatingRewritePolicy implements RewritePolicy {
|
+public final class StacktraceDeobfuscatingRewritePolicy implements RewritePolicy {
|
||||||
|
+ private StacktraceDeobfuscatingRewritePolicy() {
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public @NotNull LogEvent rewrite(final @NotNull LogEvent rewrite) {
|
+ public @NonNull LogEvent rewrite(final @NonNull LogEvent rewrite) {
|
||||||
+ final Throwable thrown = rewrite.getThrown();
|
+ final Throwable thrown = rewrite.getThrown();
|
||||||
+ if (thrown != null) {
|
+ if (thrown != null) {
|
||||||
+ StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thrown);
|
+ StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thrown);
|
||||||
|
+ return new Log4jLogEvent.Builder(rewrite)
|
||||||
|
+ .setThrownProxy(null)
|
||||||
|
+ .build();
|
||||||
+ }
|
+ }
|
||||||
+ return rewrite;
|
+ return rewrite;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @PluginFactory
|
+ @PluginFactory
|
||||||
+ public static @NotNull StacktraceDeobfuscatingRewritePolicy createPolicy() {
|
+ public static @NonNull StacktraceDeobfuscatingRewritePolicy createPolicy() {
|
||||||
+ return new StacktraceDeobfuscatingRewritePolicy();
|
+ return new StacktraceDeobfuscatingRewritePolicy();
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
|
|
|
@ -234,22 +234,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/resources/log4j2.xml
|
--- a/src/main/resources/log4j2.xml
|
||||||
+++ b/src/main/resources/log4j2.xml
|
+++ b/src/main/resources/log4j2.xml
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
<DefaultRolloverStrategy max="1000"/>
|
|
||||||
</RollingRandomAccessFile>
|
|
||||||
<Async name="Async">
|
|
||||||
- <AppenderRef ref="rewrite"/>
|
|
||||||
+ <AppenderRef ref="rewrite2"/>
|
|
||||||
</Async>
|
</Async>
|
||||||
<Rewrite name="rewrite">
|
<Rewrite name="rewrite">
|
||||||
<StacktraceDeobfuscatingRewritePolicy />
|
<StacktraceDeobfuscatingRewritePolicy />
|
||||||
@@ -0,0 +0,0 @@
|
+ <AppenderRef ref="rewrite2"/>
|
||||||
<AppenderRef ref="TerminalConsole" level="info"/>
|
+ </Rewrite>
|
||||||
<AppenderRef ref="ServerGuiConsole" level="info"/>
|
|
||||||
</Rewrite>
|
|
||||||
+ <Rewrite name="rewrite2">
|
+ <Rewrite name="rewrite2">
|
||||||
+ <ExtraClassInfoRewritePolicy />
|
+ <ExtraClassInfoRewritePolicy />
|
||||||
+ <AppenderRef ref="rewrite"/>
|
<AppenderRef ref="File"/>
|
||||||
+ </Rewrite>
|
<AppenderRef ref="TerminalConsole" level="info"/>
|
||||||
</Appenders>
|
<AppenderRef ref="ServerGuiConsole" level="info"/>
|
||||||
<Loggers>
|
|
||||||
<Root level="info">
|
|
||||||
|
|
Loading…
Reference in a new issue