mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 04:32:15 +00:00
Improve server console implementation (#4821)
This commit is contained in:
1 parent
43895d773e
commit
1db28d072a
18 files changed
+1106
-554
No files matched your search
@@ -37,7 +37,7 @@ public class FMLServerTweaker extends FMLTweaker {
|
||||
|
||||
if (System.getProperty("log4j.configurationFile") == null)
|
||||
{
|
||||
System.setProperty("log4j.configurationFile", "log4j2.xml");
|
||||
System.setProperty("log4j.configurationFile", "log4j2_server.xml");
|
||||
((LoggerContext) LogManager.getContext(false)).reconfigure();
|
||||
}
|
||||
}
|
||||
@@ -55,9 +55,9 @@ public class FMLServerTweaker extends FMLTweaker {
|
||||
// and deobfuscated parts of the code. Without, the UI won't show anything
|
||||
classLoader.addClassLoaderExclusion("com.mojang.util.QueueLogAppender");
|
||||
|
||||
classLoader.addClassLoaderExclusion("jline.");
|
||||
classLoader.addClassLoaderExclusion("org.fusesource.");
|
||||
classLoader.addClassLoaderExclusion("net.minecraftforge.server.console.log4j.TerminalConsoleAppender");
|
||||
classLoader.addClassLoaderExclusion("org.jline.");
|
||||
classLoader.addClassLoaderExclusion("com.sun.jna.");
|
||||
classLoader.addClassLoaderExclusion("net.minecraftforge.server.terminalconsole.");
|
||||
|
||||
FMLLaunchHandler.configureForServerLaunch(classLoader, this);
|
||||
FMLLaunchHandler.appendCoreMods();
|
||||
|
||||
@@ -66,6 +66,8 @@ import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.primitives.Ints;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.core.LoggerContext;
|
||||
|
||||
public class CoreModManager {
|
||||
private static final Attributes.Name COREMODCONTAINSFMLMOD = new Attributes.Name("FMLCorePluginContainsFMLMod");
|
||||
@@ -214,6 +216,16 @@ public class CoreModManager {
|
||||
{
|
||||
FMLLog.log.debug("Enabling runtime deobfuscation");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (System.getProperty("log4j.configurationFile") == null)
|
||||
{
|
||||
FMLLog.log.info("Detected deobfuscated environment, loading log configs for colored console logs.");
|
||||
// use server logging configs in deobfuscated environment so developers get nicely colored console logs
|
||||
System.setProperty("log4j.configurationFile", "log4j2_server.xml");
|
||||
((LoggerContext) LogManager.getContext(false)).reconfigure();
|
||||
}
|
||||
}
|
||||
|
||||
tweaker.injectCascadingTweak("net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker");
|
||||
try
|
||||
|
||||
@@ -21,6 +21,9 @@ package net.minecraftforge.fml.relauncher;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.core.LoggerContext;
|
||||
|
||||
public class ServerLaunchWrapper {
|
||||
|
||||
/**
|
||||
@@ -38,6 +41,11 @@ public class ServerLaunchWrapper {
|
||||
|
||||
private void run(String[] args)
|
||||
{
|
||||
if (System.getProperty("log4j.configurationFile") == null)
|
||||
{
|
||||
// Set this early so we don't need to reconfigure later
|
||||
System.setProperty("log4j.configurationFile", "log4j2_server.xml");
|
||||
}
|
||||
Class<?> launchwrapper = null;
|
||||
try
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user