From ca5ca73a9d79291607200d7a5b14e549d3efd5b4 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Tue, 5 May 2020 02:24:33 +0200 Subject: [PATCH] Try to improve build size by reducing dependencies used for logging. --- pom.xml | 13 -------- .../util/logback/SqlExceptionFilter.java | 23 +++++++++++++ src/main/resources/logback.xml | 32 ++++++------------- 3 files changed, 32 insertions(+), 36 deletions(-) create mode 100644 src/main/java/com/eu/habbo/util/logback/SqlExceptionFilter.java diff --git a/pom.xml b/pom.xml index d38ccad3..35de71dc 100644 --- a/pom.xml +++ b/pom.xml @@ -160,19 +160,6 @@ 1.18 - - org.codehaus.janino - janino - 3.1.2 - - - - org.codehaus.groovy - groovy-all - 3.0.3 - pom - - joda-time joda-time diff --git a/src/main/java/com/eu/habbo/util/logback/SqlExceptionFilter.java b/src/main/java/com/eu/habbo/util/logback/SqlExceptionFilter.java new file mode 100644 index 00000000..1026ad58 --- /dev/null +++ b/src/main/java/com/eu/habbo/util/logback/SqlExceptionFilter.java @@ -0,0 +1,23 @@ +package com.eu.habbo.util.logback; + +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.classic.spi.ThrowableProxy; +import ch.qos.logback.core.filter.Filter; +import ch.qos.logback.core.spi.FilterReply; + +import java.sql.SQLException; + +public class SqlExceptionFilter extends Filter { + + @Override + public FilterReply decide(ILoggingEvent event) { + ThrowableProxy proxy = (ThrowableProxy) event.getThrowableProxy(); + + if (proxy.getThrowable() instanceof SQLException){ + return FilterReply.ACCEPT; + } + + return FilterReply.DENY; + } + +} diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 7597aff6..6b298c13 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -9,14 +9,10 @@ logging/debug.txt - - - - e.level == DEBUG - - - DENY - NEUTRAL + + DEBUG + ACCEPT + DENY logging/debug.%d{yyyy-MM-dd}.%i.gz @@ -30,14 +26,10 @@ logging/errors/runtime.txt - - error - - - - java.sql.SQLException.class.isInstance(throwable) - - DENY + + ERROR + ACCEPT + DENY logging/errors/runtime.%d{yyyy-MM-dd}.%i.gz @@ -51,13 +43,7 @@ logging/errors/sql.txt - - - java.sql.SQLException.class.isInstance(throwable) - - DENY - NEUTRAL - + logging/errors/sql.%d{yyyy-MM-dd}.%i.gz 50MB