2015-07-27 14:20:54 +02:00
|
|
|
From c11e87b8641201bbfd08f766f27d6755241a17e5 Mon Sep 17 00:00:00 2001
|
2014-08-17 23:47:36 +02:00
|
|
|
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
|
2015-05-25 21:09:58 +02:00
|
|
|
index a187598..f6a67d6 100644
|
2014-08-17 23:47:36 +02:00
|
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
2015-02-06 11:08:31 +01:00
|
|
|
@@ -17,6 +17,9 @@ import gnu.trove.map.hash.TObjectIntHashMap;
|
2014-11-28 02:17:45 +01:00
|
|
|
import net.minecraft.server.AttributeRanged;
|
2014-08-17 23:47:36 +02:00
|
|
|
import net.minecraft.server.GenericAttributes;
|
|
|
|
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;
|
2015-05-25 21:09:58 +02:00
|
|
|
@@ -361,4 +364,27 @@ public class SpigotConfig
|
2015-02-06 11:08:31 +01:00
|
|
|
attackDamage = getDouble( "settings.attribute.attackDamage.max", attackDamage );
|
2015-05-09 22:23:26 +02:00
|
|
|
( (AttributeRanged) GenericAttributes.ATTACK_DAMAGE ).b = attackDamage;
|
2014-08-17 23:47:36 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ 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
|
2014-11-28 02:17:45 +01:00
|
|
|
index 08d68aa..f37d1c2 100644
|
2014-08-17 23:47:36 +02:00
|
|
|
--- 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>
|
|
|
|
--
|
2015-05-29 11:35:21 +02:00
|
|
|
2.1.4
|
2014-08-17 23:47:36 +02:00
|
|
|
|