mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-24 09:58:00 +01:00
cab333b217
Don't send requests of every player was found in the global api cache SpigotMC/Spigot@841270ff1e Correctly set the response code for the cached lookups and return the ... SpigotMC/Spigot@f170b7899c Don't try and re-set the global api cache on reload SpigotMC/Spigot@b410a00a66 Use a compile time sneaky throw hack. SpigotMC/Spigot@508462b96b Fix a missed rename in WorldGenGroundBush SpigotMC/Spigot@0614d8fae9
68 lines
2.5 KiB
Diff
68 lines
2.5 KiB
Diff
From f76e9e079cc7ce3361b19ba67a022ecbb8229e4e Mon Sep 17 00:00:00 2001
|
|
From: Minecrell <dev@minecrell.net>
|
|
Date: Sun, 17 Aug 2014 12:42:53 +0200
|
|
Subject: [PATCH] Make debug logging togglable.
|
|
|
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
index 6baa678..3459d87 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
@@ -18,6 +18,9 @@ import net.minecraft.server.AttributeRanged;
|
|
import net.minecraft.server.GenericAttributes;
|
|
import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap;
|
|
import net.minecraft.server.MinecraftServer;
|
|
+import org.apache.logging.log4j.LogManager;
|
|
+import org.apache.logging.log4j.core.LoggerContext;
|
|
+import org.apache.logging.log4j.core.config.Configuration;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.ChatColor;
|
|
import org.bukkit.command.Command;
|
|
@@ -372,4 +375,27 @@ public class SpigotConfig
|
|
URL.setURLStreamHandlerFactory(new CachedStreamHandlerFactory());
|
|
}
|
|
}
|
|
+
|
|
+ public static boolean debug;
|
|
+ private static void debug()
|
|
+ {
|
|
+ debug = getBoolean( "settings.debug", false );
|
|
+
|
|
+ if ( debug && !LogManager.getRootLogger().isTraceEnabled() )
|
|
+ {
|
|
+ // Enable debug logging
|
|
+ LoggerContext ctx = (LoggerContext) LogManager.getContext( false );
|
|
+ Configuration conf = ctx.getConfiguration();
|
|
+ conf.getLoggerConfig( LogManager.ROOT_LOGGER_NAME ).setLevel( org.apache.logging.log4j.Level.ALL );
|
|
+ ctx.updateLoggers( conf );
|
|
+ }
|
|
+
|
|
+ if ( LogManager.getRootLogger().isTraceEnabled() )
|
|
+ {
|
|
+ Bukkit.getLogger().info( "Debug logging is enabled" );
|
|
+ } else
|
|
+ {
|
|
+ Bukkit.getLogger().info( "Debug logging is disabled" );
|
|
+ }
|
|
+ }
|
|
}
|
|
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
|
|
index e2209b8..65c09a8 100644
|
|
--- a/src/main/resources/log4j2.xml
|
|
+++ b/src/main/resources/log4j2.xml
|
|
@@ -18,9 +18,9 @@
|
|
<filters>
|
|
<MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
|
|
</filters>
|
|
- <AppenderRef ref="WINDOWS_COMPAT"/>
|
|
+ <AppenderRef ref="WINDOWS_COMPAT" level="info"/>
|
|
<AppenderRef ref="File"/>
|
|
- <AppenderRef ref="TerminalConsole"/>
|
|
+ <AppenderRef ref="TerminalConsole" level="info"/>
|
|
</Root>
|
|
</Loggers>
|
|
</Configuration>
|
|
--
|
|
1.9.1
|
|
|