Fix logging problems- log death messages and re-route the server through FML logs properly.

This commit is contained in:
Christian 2012-10-17 18:05:23 -04:00
parent 4af51b0cad
commit 3599c11599
3 changed files with 44 additions and 1 deletions

View file

@ -22,13 +22,18 @@ public class FMLRelaunchLog
@Override @Override
public void publish(LogRecord record) public void publish(LogRecord record)
{ {
boolean currInt = Thread.interrupted();
try try
{ {
ConsoleLogThread.recordQueue.put(record); ConsoleLogThread.recordQueue.put(record);
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
Thread.interrupted(); e.printStackTrace(errCache);
}
if (currInt)
{
Thread.currentThread().interrupt();
} }
} }
@ -61,6 +66,7 @@ public class FMLRelaunchLog
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
e.printStackTrace(errCache);
Thread.interrupted(); Thread.interrupted();
// Stupid // Stupid
} }
@ -114,6 +120,8 @@ public class FMLRelaunchLog
private static boolean configured; private static boolean configured;
private static Thread consoleLogThread; private static Thread consoleLogThread;
private static PrintStream errCache;
private Logger myLog; private Logger myLog;
private FMLRelaunchLog() private FMLRelaunchLog()
@ -157,6 +165,8 @@ public class FMLRelaunchLog
} }
// Set system out to a log stream // Set system out to a log stream
errCache = System.err;
System.setOut(new PrintStream(new LoggingOutStream(stdOut), true)); System.setOut(new PrintStream(new LoggingOutStream(stdOut), true));
System.setErr(new PrintStream(new LoggingOutStream(stdErr), true)); System.setErr(new PrintStream(new LoggingOutStream(stdErr), true));

View file

@ -0,0 +1,23 @@
--- ../src-base/common/net/minecraft/src/ConsoleLogManager.java
+++ ../src-work/common/net/minecraft/src/ConsoleLogManager.java
@@ -4,6 +4,8 @@
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
+
+import cpw.mods.fml.common.FMLLog;
public class ConsoleLogManager
{
@@ -12,10 +14,7 @@
public static void func_73699_a()
{
ConsoleLogFormatter var0 = new ConsoleLogFormatter();
- field_73700_a.setUseParentHandlers(false);
- ConsoleHandler var1 = new ConsoleHandler();
- var1.setFormatter(var0);
- field_73700_a.addHandler(var1);
+ field_73700_a.setParent(FMLLog.getLogger());
try
{

View file

@ -0,0 +1,10 @@
--- ../src-base/common/net/minecraft/src/EntityPlayerMP.java
+++ ../src-work/common/net/minecraft/src/EntityPlayerMP.java
@@ -270,6 +270,7 @@
public void func_70645_a(DamageSource p_70645_1_)
{
this.field_71133_b.func_71203_ab().func_72384_a(new Packet3Chat(p_70645_1_.func_76360_b(this)));
+ this.field_71133_b.func_71203_ab().field_72406_a.info(p_70645_1_.func_76360_b(this));
this.field_71071_by.func_70436_m();
}