From 88ab0b4097348e0d1c310e1412d28b1023d5465a Mon Sep 17 00:00:00 2001 From: StarWishsama Date: Mon, 27 May 2024 12:53:13 +0800 Subject: [PATCH] chore: remove unused hikari filter --- CONTRIBUTING.md | 2 +- pom.xml | 2 +- .../norain/slimefun4/SlimefunExtended.java | 2 - .../slimefun4/utils/HikariLogFilter.java | 50 ------------------- 4 files changed, 2 insertions(+), 54 deletions(-) delete mode 100644 src/main/java/city/norain/slimefun4/utils/HikariLogFilter.java diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 87a1b8ff9a..1c27c23107 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ # 设置环境 -我们提供了一个自动化格式检查系统,请使用 `mvn configure` 进行初始化。 +我们提供了一个自动化格式检查系统,请使用 `mvn install` 进行初始化。 本项目已经提供 `.editorconfig` 用于控制代码样式。如果你有自己的代码样式风格,请在对本仓库进行贡献前切换为当前仓库的风格配置。 diff --git a/pom.xml b/pom.xml index 8fd9dad7a2..bff339ba85 100644 --- a/pom.xml +++ b/pom.xml @@ -207,7 +207,7 @@ - configure + install diff --git a/src/main/java/city/norain/slimefun4/SlimefunExtended.java b/src/main/java/city/norain/slimefun4/SlimefunExtended.java index a614f4f9a8..adacde99bb 100644 --- a/src/main/java/city/norain/slimefun4/SlimefunExtended.java +++ b/src/main/java/city/norain/slimefun4/SlimefunExtended.java @@ -1,7 +1,6 @@ package city.norain.slimefun4; import city.norain.slimefun4.listener.SlimefunMigrateListener; -import city.norain.slimefun4.utils.HikariLogFilter; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import java.util.logging.Level; import javax.annotation.Nonnull; @@ -16,7 +15,6 @@ public final class SlimefunExtended { private static void checkDebug() { if ("true".equals(System.getProperty("slimefun.database.debug"))) { databaseDebugMode = true; - HikariLogFilter.registerFilter(org.apache.logging.log4j.Level.DEBUG); } } diff --git a/src/main/java/city/norain/slimefun4/utils/HikariLogFilter.java b/src/main/java/city/norain/slimefun4/utils/HikariLogFilter.java deleted file mode 100644 index 582b1eba7a..0000000000 --- a/src/main/java/city/norain/slimefun4/utils/HikariLogFilter.java +++ /dev/null @@ -1,50 +0,0 @@ -package city.norain.slimefun4.utils; - -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Marker; -import org.apache.logging.log4j.core.LogEvent; -import org.apache.logging.log4j.core.Logger; -import org.apache.logging.log4j.core.filter.AbstractFilter; -import org.apache.logging.log4j.message.Message; - -public class HikariLogFilter extends AbstractFilter { - private final Level level; - - public HikariLogFilter(Level level) { - this.level = level; - } - - public static void registerFilter(Level level) { - Logger logger = (Logger) LogManager.getRootLogger(); - logger.addFilter(new HikariLogFilter(level)); - } - - @Override - public Result filter(LogEvent event) { - if (event == null) { - return Result.NEUTRAL; - } - - if (event.getLoggerName().contains("Hikari") && event.getLevel().isInRange(level, Level.FATAL)) { - return Result.ACCEPT; - } - - return Result.NEUTRAL; - } - - @Override - public Result filter(Logger logger, Level level, Marker marker, Message msg, Throwable t) { - return Result.NEUTRAL; - } - - @Override - public Result filter(Logger logger, Level level, Marker marker, String msg, Object... params) { - return Result.NEUTRAL; - } - - @Override - public Result filter(Logger logger, Level level, Marker marker, Object msg, Throwable t) { - return Result.NEUTRAL; - } -}