Skip to content

Commit

Permalink
Use JAVA System.Logger instead of JUL and redirect it to Log4J2
Browse files Browse the repository at this point in the history
  • Loading branch information
matyasberry committed Oct 4, 2024
1 parent b508069 commit 9eacb4e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
16 changes: 5 additions & 11 deletions config/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
<groupId>io.scalecube</groupId>
Expand Down Expand Up @@ -43,21 +43,15 @@
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
<artifactId>log4j-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
<artifactId>log4j-jpl</artifactId>
<version>2.20.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import io.scalecube.config.source.ConfigSource;
import io.scalecube.config.source.LoadedConfigProperty;
import io.scalecube.config.utils.ThrowableUtil;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -22,8 +24,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.Supplier;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collector;
import java.util.stream.Collectors;

Expand All @@ -33,7 +33,7 @@
*/
public class KeyValueConfigSource implements ConfigSource {

private static final Logger LOGGER = Logger.getLogger(KeyValueConfigSource.class.getName());
private static final Logger LOGGER = System.getLogger(KeyValueConfigSource.class.getName());

private static final ThreadFactory threadFactory;

Expand All @@ -44,7 +44,7 @@ public class KeyValueConfigSource implements ConfigSource {
thread.setDaemon(true);
thread.setName("keyvalue-config-executor");
thread.setUncaughtExceptionHandler(
(t, e) -> LOGGER.log(Level.SEVERE, "Exception occurred: " + e, e));
(t, e) -> LOGGER.log(Level.ERROR, "Exception occurred: {0}", e));
return thread;
};
}
Expand Down Expand Up @@ -131,9 +131,9 @@ private CompletableFuture<List<KeyValueConfigEntity>> loadConfig(KeyValueConfigN
} catch (Exception e) {
LOGGER.log(
Level.WARNING,
String.format(
"Exception at %s.findAll(%s)",
repository.getClass().getSimpleName(), configName),
"Exception at {0}.findAll({1}) {2}",
repository.getClass().getSimpleName(),
configName,
e);
result = Collections.emptyList();
}
Expand Down

0 comments on commit 9eacb4e

Please sign in to comment.