Try to improve build size by reducing dependencies used for logging.

This commit is contained in:
Mike 2020-05-05 02:24:33 +02:00
parent b5265a1fd2
commit ca5ca73a9d
3 changed files with 32 additions and 36 deletions

13
pom.xml
View File

@ -160,19 +160,6 @@
<version>1.18</version>
</dependency>
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>3.0.3</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>

View File

@ -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<ILoggingEvent> {
@Override
public FilterReply decide(ILoggingEvent event) {
ThrowableProxy proxy = (ThrowableProxy) event.getThrowableProxy();
if (proxy.getThrowable() instanceof SQLException){
return FilterReply.ACCEPT;
}
return FilterReply.DENY;
}
}

View File

@ -9,14 +9,10 @@
<appender name="FileDebug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logging/debug.txt</file>
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator">
<expression>
e.level == DEBUG
</expression>
</evaluator>
<OnMismatch>DENY</OnMismatch>
<OnMatch>NEUTRAL</OnMatch>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>DEBUG</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>logging/debug.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
@ -30,14 +26,10 @@
<appender name="FileErrors" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logging/errors/runtime.txt</file>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>error</level>
</filter>
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator>
<expression>java.sql.SQLException.class.isInstance(throwable)</expression>
</evaluator>
<OnMatch>DENY</OnMatch>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>logging/errors/runtime.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
@ -51,13 +43,7 @@
<appender name="FileErrorsSql" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logging/errors/sql.txt</file>
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator>
<expression>java.sql.SQLException.class.isInstance(throwable)</expression>
</evaluator>
<OnMismatch>DENY</OnMismatch>
<OnMatch>NEUTRAL</OnMatch>
</filter>
<filter class="com.eu.habbo.util.logback.SqlExceptionFilter" />
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>logging/errors/sql.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>