Skip to content

Commit

Permalink
disable logging in relevant class
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Nov 5, 2024
1 parent 15e97a5 commit 60bf157
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class AEFModule implements ConditionalEnableable, Disableable {

static {
// Disable reflection logging for this operation because its just confusing and provides no value.
Configurator.setLevel(AEFModule.class.getPackage().getName() + ".libs.reflections.Reflections", Level.OFF);
Configurator.setLevel(AnarchyExploitFixes.class.getPackage().getName() + ".libs.reflections.Reflections", Level.OFF);
AVAILABLE_MODULES = new Reflections(AEFModule.class.getPackage().getName())
.get(Scanners.SubTypes.of(AEFModule.class).asClass())
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import me.xginko.aef.utils.CachingPermTool;
import me.xginko.aef.utils.PlatformUtil;
import me.xginko.aef.utils.tickdata.TickReporter;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.config.Configurator;
import org.bstats.bukkit.Metrics;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -52,13 +50,6 @@ public final class AnarchyExploitFixes extends JavaPlugin {
@Override
public void onLoad() {
PlatformUtil.load();
// Disable logging for some shaded libraries as those can get very verbose
String shadedLibs = getClass().getPackage().getName() + ".libs";
Configurator.setLevel(shadedLibs + ".zaxxer.hikari.pool.PoolBase", Level.OFF);
Configurator.setLevel(shadedLibs + ".zaxxer.hikari.pool.HikariPool", Level.OFF);
Configurator.setLevel(shadedLibs + ".zaxxer.hikari.HikariDataSource", Level.OFF);
Configurator.setLevel(shadedLibs + ".zaxxer.hikari.HikariConfig", Level.OFF);
Configurator.setLevel(shadedLibs + ".zaxxer.hikari.util.DriverDataSource", Level.OFF);
isPacketEventsInstalled = getServer().getPluginManager().getPlugin("packetevents") != null;
if (isPacketEventsInstalled) {
// Configure and load packetevents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.zaxxer.hikari.HikariDataSource;
import me.xginko.aef.AnarchyExploitFixes;
import me.xginko.aef.utils.models.Disableable;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.config.Configurator;

import javax.sql.DataSource;
import java.sql.Connection;
Expand All @@ -19,6 +21,16 @@ public class Datastore implements Disableable {
private final DataSource dataSource;
private final String loadPlayer, savePlayerConMsgSetting;

static {
// Disable logging because hikari is VERY verbose
String hikariShaded = AnarchyExploitFixes.class.getPackage().getName() + ".libs.zaxxer.hikari";
Configurator.setLevel(hikariShaded + ".pool.PoolBase", Level.OFF);
Configurator.setLevel(hikariShaded + ".pool.HikariPool", Level.OFF);
Configurator.setLevel(hikariShaded + ".HikariDataSource", Level.OFF);
Configurator.setLevel(hikariShaded + ".HikariConfig", Level.OFF);
Configurator.setLevel(hikariShaded + ".util.DriverDataSource", Level.OFF);
}

public Datastore() {
HikariConfig config = new HikariConfig();
AnarchyExploitFixes plugin = AnarchyExploitFixes.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class AEFModule implements ConditionalEnableable, Disableable {

static {
// Disable reflection logging for this operation because its just confusing and provides no value.
Configurator.setLevel(AEFModule.class.getPackage().getName() + ".libs.reflections.Reflections", Level.OFF);
Configurator.setLevel(AnarchyExploitFixes.class.getPackage().getName() + ".libs.reflections.Reflections", Level.OFF);
AVAILABLE_MODULES = new Reflections(AEFModule.class.getPackage().getName())
.get(Scanners.SubTypes.of(AEFModule.class).asClass())
.stream()
Expand Down

0 comments on commit 60bf157

Please sign in to comment.