aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0219-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch
blob: 448b0f8554b4f4f178d38cc2ff0148f42aac9eb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Thu, 12 Aug 2021 04:46:41 -0700
Subject: [PATCH] Use AsyncAppender to keep logging IO off main thread


diff --git a/build.gradle.kts b/build.gradle.kts
index bfa7e0cb164bdf31b5f54945c6b4345379cfc747..a00d4f3763929e605bb3ffbbd838e51a77006992 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -29,6 +29,7 @@ dependencies {
     implementation("commons-lang:commons-lang:2.6")
     runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.0")
     runtimeOnly("com.mysql:mysql-connector-j:8.0.33")
+    runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
 
     runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.2")
     runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.10")
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index 88957220d5574e5590e8a545605d76c0c7b0a10e..ea4e2161c0bd43884055cc6b8d70b2139f70e720 100644
--- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml
@@ -29,15 +29,18 @@
             </Policies>
             <DefaultRolloverStrategy max="1000"/>
         </RollingRandomAccessFile>
+        <Async name="Async">
+            <AppenderRef ref="File"/>
+            <AppenderRef ref="TerminalConsole" level="info"/>
+            <AppenderRef ref="ServerGuiConsole" level="info"/>
+        </Async>
     </Appenders>
     <Loggers>
         <Root level="info">
             <filters>
                 <MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
             </filters>
-            <AppenderRef ref="File"/>
-            <AppenderRef ref="TerminalConsole" level="info"/>
-            <AppenderRef ref="ServerGuiConsole" level="info"/>
+            <AppenderRef ref="Async"/>
         </Root>
     </Loggers>
 </Configuration>