From 3a11656909e11e85f408d6e303eeb752707f8d99 Mon Sep 17 00:00:00 2001 From: Janmm14 Date: Sat, 18 Dec 2021 23:53:13 +0100 Subject: [PATCH] #3116: Do not fill in LogRecord caller data by default in slf4j wrapper --- slf4j/src/main/java/org/slf4j/impl/JDK14LoggerAdapter.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/slf4j/src/main/java/org/slf4j/impl/JDK14LoggerAdapter.java b/slf4j/src/main/java/org/slf4j/impl/JDK14LoggerAdapter.java index 7cfafc88..49589454 100644 --- a/slf4j/src/main/java/org/slf4j/impl/JDK14LoggerAdapter.java +++ b/slf4j/src/main/java/org/slf4j/impl/JDK14LoggerAdapter.java @@ -585,6 +585,8 @@ public final class JDK14LoggerAdapter extends MarkerIgnoringBase implements Loca static String SELF = JDK14LoggerAdapter.class.getName(); static String SUPER = MarkerIgnoringBase.class.getName(); + private static final boolean FILL_CALLER_DATA = Boolean.getBoolean( "net.md_5.bungee.slf4j-caller-data" ); + /** * Fill in caller data if possible. * @@ -592,6 +594,10 @@ public final class JDK14LoggerAdapter extends MarkerIgnoringBase implements Loca * The record to update */ final private void fillCallerData(String callerFQCN, LogRecord record) { + if ( !FILL_CALLER_DATA ) + { + return; + } StackTraceElement[] steArray = new Throwable().getStackTrace(); int selfIndex = -1;