From 045bcf6dc50bb58c22880c0a7b4e4a9e14813490 Mon Sep 17 00:00:00 2001 From: P0nk Date: Wed, 7 Apr 2021 17:23:14 +0200 Subject: [PATCH] Set up Slf4j and Log4j2 for logging All logs are kept in the "logs" directory as before. The most recent logs (up to 20MB) are kept in cosmic-log.log in the root of "logs". Previous logs (either from previous server starts or logfiles that exceeded max size of 20MB) are stored away in directories according to their creation date. --- pom.xml | 34 ++++++++++++++++++++++++---------- src/main/resources/log4j2.xml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 src/main/resources/log4j2.xml diff --git a/pom.xml b/pom.xml index 7341ff2b53..629bf42035 100644 --- a/pom.xml +++ b/pom.xml @@ -15,6 +15,8 @@ 1.8 1.8 net.server.Server + + 2.14.1 @@ -33,21 +35,33 @@ mysql-connector-java 8.0.23 - - org.slf4j - slf4j-api - 1.7.21 - - - org.slf4j - slf4j-jdk14 - 1.7.5 - com.esotericsoftware.yamlbeans yamlbeans 1.13 + + + + org.slf4j + slf4j-api + 1.7.30 + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + + + org.apache.logging.log4j + log4j-api + ${log4j.version} + + + org.apache.logging.log4j + log4j-slf4j-impl + ${log4j.version} + diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml new file mode 100644 index 0000000000..286496cbf0 --- /dev/null +++ b/src/main/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + cosmic-log + + + + + + + + %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + + + \ No newline at end of file