This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 9331b607ce OAK-10848: commons: remove use of slf4j.event.Level in 
SystemPropertySupplier implementation (#1580)
9331b607ce is described below

commit 9331b607ce9b74d011cf24c8d7b2f2e9b0a930dc
Author: Julian Reschke <resc...@apache.org>
AuthorDate: Mon Jul 15 16:12:47 2024 +0200

    OAK-10848: commons: remove use of slf4j.event.Level in 
SystemPropertySupplier implementation (#1580)
---
 .../commons/properties/SystemPropertySupplier.java | 25 +++++++---------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git 
a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/properties/SystemPropertySupplier.java
 
b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/properties/SystemPropertySupplier.java
index c1b0da0e59..30ad2c5961 100644
--- 
a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/properties/SystemPropertySupplier.java
+++ 
b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/properties/SystemPropertySupplier.java
@@ -25,7 +25,6 @@ import java.util.function.Supplier;
 import org.jetbrains.annotations.NotNull;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.slf4j.event.Level;
 
 /**
  * Utility class for consistent handling of system properties.
@@ -50,7 +49,7 @@ public class SystemPropertySupplier<T> implements Supplier<T> 
{
     private final Function<String, T> parser;
 
     private Logger log = LOG;
-    private Level successLogLevel = Level.INFO;
+    private String successLogLevel = "INFO";
     private Predicate<T> validator = (a) -> true;
     private Function<String, String> sysPropReader = System::getProperty;
     private BiFunction<String, T, String> setMessageFormatter = (a, b) -> {
@@ -100,22 +99,14 @@ public class SystemPropertySupplier<T> implements 
Supplier<T> {
      * Specify {@link Level} to use for "success" message (defaults to "INFO")
      */
     public SystemPropertySupplier<T> logSuccessAs(String successLogLevel) {
-        Level newLevel;
+        String newLevel;
         switch (Objects.requireNonNull(successLogLevel)) {
             case "DEBUG":
-                newLevel = Level.DEBUG;
-                break;
             case "ERROR":
-                newLevel = Level.ERROR;
-                break;
             case "INFO":
-                newLevel = Level.INFO;
-                break;
             case "TRACE":
-                newLevel = Level.TRACE;
-                break;
             case "WARN":
-                newLevel = Level.WARN;
+                newLevel = successLogLevel;
                 break;
             default:
                 throw new IllegalArgumentException("unsupported log level: " + 
successLogLevel);
@@ -162,19 +153,19 @@ public class SystemPropertySupplier<T> implements 
Supplier<T> {
             if (!ret.equals(defaultValue)) {
                 String msg = setMessageFormatter.apply(propName, ret);
                 switch (successLogLevel) {
-                    case INFO:
+                    case "INFO":
                         log.info(msg);
                         break;
-                    case DEBUG:
+                    case "DEBUG":
                         log.debug(msg);
                         break;
-                    case ERROR:
+                    case "ERROR":
                         log.error(msg);
                         break;
-                    case TRACE:
+                    case "TRACE":
                         log.trace(msg);
                         break;
-                    case WARN:
+                    case "WARN":
                         log.warn(msg);
                         break;
                     default:

Reply via email to