Skip to content

Commit

Permalink
Use slf4j logger instead of JUL
Browse files Browse the repository at this point in the history
This fixes logging issues in certain environments.
Also replace stacktrace printing with logging it.
  • Loading branch information
Phoenix616 committed Mar 13, 2024
1 parent 1bbaf29 commit 86eea54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/main/java/net/azisaba/kuvel/Kuvel.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.nio.file.Path;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import lombok.Getter;
import net.azisaba.kuvel.config.KuvelConfig;
import net.azisaba.kuvel.discovery.impl.redis.RedisLoadBalancerDiscovery;
Expand All @@ -24,6 +23,7 @@
import net.azisaba.kuvel.redis.ProxyIdProvider;
import net.azisaba.kuvel.redis.RedisConnectionLeader;
import net.azisaba.kuvel.redis.RedisSubscriberExecutor;
import org.slf4j.Logger;

@Plugin(
id = "kuvel",
Expand Down Expand Up @@ -63,8 +63,7 @@ public void onProxyInitialization(ProxyInitializeEvent event) {
try {
kuvelConfig.load();
} catch (Exception e) {
logger.severe("Failed to load config file. Plugin feature will be disabled.");
e.printStackTrace();
logger.error("Failed to load config file. Plugin feature will be disabled.", e);
return;
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/net/azisaba/kuvel/config/KuvelConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public void load() throws IOException {
} catch (NumberFormatException e) {
plugin
.getLogger()
.warning("Invalid port number for Redis connection specified in KUVEL_REDIS_CONNECTION_PORT environment variable. Using port " + port + " from config.yml.");
.warn(
"Invalid port number for Redis connection specified in KUVEL_REDIS_CONNECTION_PORT environment variable. Using port " + port + " from config.yml.");
}
}
String username = env.getOrDefault("KUVEL_REDIS_CONNECTION_USERNAME", conf.getString("redis.connection.username"));
Expand All @@ -48,7 +49,7 @@ public void load() throws IOException {
redisEnabled = false;
plugin
.getLogger()
.warning(
.warn(
"Redis is enabled, but hostname or port is invalid. Redis sync will be disabled.");
} else {
redisConnectionData = new RedisConnectionData(hostname, port, username, password);
Expand Down

0 comments on commit 86eea54

Please sign in to comment.