From b3d6b112d20ea9cb088e3a7fac2f87cb2aae0539 Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 14 Aug 2021 10:33:52 +0100 Subject: [PATCH] Add Logback configuration file There are two main reasons for this change: by default, logback uses stdout (!) and not stderr. This caused problems in programs like packclass/unpackclass, where the packclass or JAR files were mixed in with Netty's debug logging. Secondly, the debug logging from lots of third-party libraries was annoying (as it made it difficult to pick out OpenRS2-specific log messages), so I've disabled lots of it. Signed-off-by: Graham --- all/build.gradle.kts | 1 + archive/build.gradle.kts | 1 + buffer-generator/build.gradle.kts | 1 + compress-cli/build.gradle.kts | 1 + crc32/build.gradle.kts | 2 ++ decompiler/build.gradle.kts | 1 + deob-ast/build.gradle.kts | 1 + deob-bytecode/build.gradle.kts | 1 + deob/build.gradle.kts | 1 + game/build.gradle.kts | 1 + log/build.gradle.kts | 20 ++++++++++++++++++++ log/src/main/resources/logback.xml | 25 +++++++++++++++++++++++++ patcher/build.gradle.kts | 1 + settings.gradle.kts | 1 + 14 files changed, 58 insertions(+) create mode 100644 log/build.gradle.kts create mode 100644 log/src/main/resources/logback.xml diff --git a/all/build.gradle.kts b/all/build.gradle.kts index 1ac8c0be..3b761156 100644 --- a/all/build.gradle.kts +++ b/all/build.gradle.kts @@ -21,6 +21,7 @@ dependencies { implementation(projects.crc32) implementation(projects.deob) implementation(projects.game) + implementation(projects.log) implementation(projects.patcher) } diff --git a/archive/build.gradle.kts b/archive/build.gradle.kts index c20d045e..f40f0892 100644 --- a/archive/build.gradle.kts +++ b/archive/build.gradle.kts @@ -18,6 +18,7 @@ dependencies { implementation(projects.http) implementation(projects.inject) implementation(projects.json) + implementation(projects.log) implementation(projects.net) implementation(projects.protocol) implementation(projects.util) diff --git a/buffer-generator/build.gradle.kts b/buffer-generator/build.gradle.kts index 47becb2b..d75a82f7 100644 --- a/buffer-generator/build.gradle.kts +++ b/buffer-generator/build.gradle.kts @@ -11,6 +11,7 @@ application { dependencies { api(libs.clikt) + implementation(projects.log) implementation(projects.util) implementation(libs.kotlinPoet) implementation(libs.netty.buffer) diff --git a/compress-cli/build.gradle.kts b/compress-cli/build.gradle.kts index 40709882..08d54d29 100644 --- a/compress-cli/build.gradle.kts +++ b/compress-cli/build.gradle.kts @@ -13,6 +13,7 @@ dependencies { implementation(projects.asm) implementation(projects.compress) + implementation(projects.log) implementation(projects.util) } diff --git a/crc32/build.gradle.kts b/crc32/build.gradle.kts index a3bc4328..d0df705f 100644 --- a/crc32/build.gradle.kts +++ b/crc32/build.gradle.kts @@ -10,6 +10,8 @@ application { dependencies { api(libs.clikt) + + implementation(projects.log) } publishing { diff --git a/decompiler/build.gradle.kts b/decompiler/build.gradle.kts index 5d0952dc..55d66c0f 100644 --- a/decompiler/build.gradle.kts +++ b/decompiler/build.gradle.kts @@ -14,6 +14,7 @@ dependencies { api(libs.clikt) api(libs.guice) + implementation(projects.log) implementation(projects.util) implementation(libs.fernflower) } diff --git a/deob-ast/build.gradle.kts b/deob-ast/build.gradle.kts index e4ebb93c..902ec4d5 100644 --- a/deob-ast/build.gradle.kts +++ b/deob-ast/build.gradle.kts @@ -14,6 +14,7 @@ dependencies { api(libs.guice) implementation(projects.inject) + implementation(projects.log) implementation(projects.util) implementation(libs.guava) implementation(libs.javaParser) diff --git a/deob-bytecode/build.gradle.kts b/deob-bytecode/build.gradle.kts index cf5d872b..9ce27715 100644 --- a/deob-bytecode/build.gradle.kts +++ b/deob-bytecode/build.gradle.kts @@ -15,6 +15,7 @@ dependencies { implementation(projects.deobAnnotations) implementation(projects.deobUtil) implementation(projects.inject) + implementation(projects.log) implementation(projects.patcher) implementation(projects.yaml) implementation(libs.fastutil) diff --git a/deob/build.gradle.kts b/deob/build.gradle.kts index 52696627..a0ef160b 100644 --- a/deob/build.gradle.kts +++ b/deob/build.gradle.kts @@ -16,6 +16,7 @@ dependencies { implementation(projects.deobAst) implementation(projects.deobBytecode) implementation(projects.inject) + implementation(projects.log) } publishing { diff --git a/game/build.gradle.kts b/game/build.gradle.kts index 2d83a977..645fad52 100644 --- a/game/build.gradle.kts +++ b/game/build.gradle.kts @@ -15,6 +15,7 @@ dependencies { implementation(projects.cache550) implementation(projects.conf) implementation(projects.inject) + implementation(projects.log) implementation(projects.net) implementation(projects.protocol) implementation(projects.util) diff --git a/log/build.gradle.kts b/log/build.gradle.kts new file mode 100644 index 00000000..e5a32158 --- /dev/null +++ b/log/build.gradle.kts @@ -0,0 +1,20 @@ +plugins { + `maven-publish` + kotlin("jvm") +} + +publishing { + publications.create("maven") { + from(components["java"]) + + pom { + packaging = "jar" + name.set("OpenRS2 Logging") + description.set( + """ + Provides OpenRS2's logback configuration file. + """.trimIndent() + ) + } + } +} diff --git a/log/src/main/resources/logback.xml b/log/src/main/resources/logback.xml new file mode 100644 index 00000000..6a41c66c --- /dev/null +++ b/log/src/main/resources/logback.xml @@ -0,0 +1,25 @@ + + + + System.err + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + + + + + + diff --git a/patcher/build.gradle.kts b/patcher/build.gradle.kts index e68e1128..bda4cfa0 100644 --- a/patcher/build.gradle.kts +++ b/patcher/build.gradle.kts @@ -15,6 +15,7 @@ dependencies { implementation(projects.conf) implementation(projects.inject) + implementation(projects.log) implementation(libs.openrs2.natives) } diff --git a/settings.gradle.kts b/settings.gradle.kts index 9d15f0ce..ddf3d327 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -50,6 +50,7 @@ include( "http", "inject", "json", + "log", "net", "nonfree", "nonfree:client",