mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-03 17:29:56 +01:00
799f6af357
Chunk related stuff will need to be revisted later
50 lines
2.1 KiB
Diff
50 lines
2.1 KiB
Diff
From 3e140363bc07b0523ddad00c7c75be134d659023 Mon Sep 17 00:00:00 2001
|
|
From: Minecrell <minecrell@minecrell.net>
|
|
Date: Mon, 18 Sep 2017 12:00:03 +0200
|
|
Subject: [PATCH] Use Log4j IOStreams to redirect System.out/err to logger
|
|
|
|
Log4j2 provides an optimized implementation of PrintStream that
|
|
redirects its output to a logger. Use it instead of a custom
|
|
implementation for minor performance improvements and some fixes.
|
|
|
|
With the old implementation, each call to System.print()
|
|
results in a separate line, even though it should not result in
|
|
a line break. Log4j's implementation handles it correctly.
|
|
|
|
diff --git a/pom.xml b/pom.xml
|
|
index 108c8c05e..183c3c4c8 100644
|
|
--- a/pom.xml
|
|
+++ b/pom.xml
|
|
@@ -63,6 +63,11 @@
|
|
<version>2.8.1</version>
|
|
<scope>runtime</scope>
|
|
</dependency>
|
|
+ <dependency>
|
|
+ <groupId>org.apache.logging.log4j</groupId>
|
|
+ <artifactId>log4j-iostreams</artifactId>
|
|
+ <version>2.8.1</version>
|
|
+ </dependency>
|
|
<dependency>
|
|
<groupId>org.ow2.asm</groupId>
|
|
<artifactId>asm</artifactId>
|
|
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
|
index 3d0cb874d..d9f1c2205 100644
|
|
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
|
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
|
@@ -135,8 +135,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
|
*/
|
|
// Paper end
|
|
|
|
- System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true));
|
|
- System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true));
|
|
+ // Paper start - Use Log4j IOStreams
|
|
+ System.setOut(org.apache.logging.log4j.io.IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream());
|
|
+ System.setErr(org.apache.logging.log4j.io.IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream());
|
|
+ // Paper end
|
|
// CraftBukkit end
|
|
|
|
thread.setDaemon(true);
|
|
--
|
|
2.21.0
|
|
|