#3116: Do not fill in LogRecord caller data by default in slf4j wrapper

This commit is contained in:
Janmm14 2021-12-18 23:53:13 +01:00 committed by GitHub
parent 2479fab632
commit 3a11656909
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -585,6 +585,8 @@ public final class JDK14LoggerAdapter extends MarkerIgnoringBase implements Loca
static String SELF = JDK14LoggerAdapter.class.getName(); static String SELF = JDK14LoggerAdapter.class.getName();
static String SUPER = MarkerIgnoringBase.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. * Fill in caller data if possible.
* *
@ -592,6 +594,10 @@ public final class JDK14LoggerAdapter extends MarkerIgnoringBase implements Loca
* The record to update * The record to update
*/ */
final private void fillCallerData(String callerFQCN, LogRecord record) { final private void fillCallerData(String callerFQCN, LogRecord record) {
if ( !FILL_CALLER_DATA )
{
return;
}
StackTraceElement[] steArray = new Throwable().getStackTrace(); StackTraceElement[] steArray = new Throwable().getStackTrace();
int selfIndex = -1; int selfIndex = -1;