diff --git a/build.sbt b/build.sbt index aa0c2640ceea..2dd1b2fb0531 100644 --- a/build.sbt +++ b/build.sbt @@ -1105,6 +1105,7 @@ lazy val `persistance` = (project in file("lib/java/persistance")) frgaalJavaCompilerSetting, Compile / javacOptions := ((Compile / javacOptions).value), libraryDependencies ++= Seq( + "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test diff --git a/lib/java/persistance/src/main/java/org/enso/persist/PerGenerator.java b/lib/java/persistance/src/main/java/org/enso/persist/PerGenerator.java index 3508a7881575..aceebece524c 100644 --- a/lib/java/persistance/src/main/java/org/enso/persist/PerGenerator.java +++ b/lib/java/persistance/src/main/java/org/enso/persist/PerGenerator.java @@ -9,8 +9,7 @@ import java.util.IdentityHashMap; import java.util.Map; import java.util.function.Function; -import java.util.logging.Level; -import java.util.logging.Logger; +import org.slf4j.Logger; final class PerGenerator { static final byte[] HEADER = new byte[] {0x0a, 0x0d, 0x03, 0x0f}; @@ -31,7 +30,7 @@ private PerGenerator( } static byte[] writeObject(Object obj, Function writeReplace) throws IOException { - var histogram = PerUtils.LOG.isLoggable(Level.FINE) ? new Histogram() : null; + var histogram = PerUtils.LOG.isDebugEnabled() ? new Histogram() : null; var out = new ByteArrayOutputStream(); var data = new DataOutputStream(out); @@ -140,16 +139,14 @@ private void dump(Logger log, int length) { return a.getValue()[0] - b.getValue()[0]; }); - log.fine("==== Top Bytes & Counts of Classes ====="); + log.debug("==== Top Bytes & Counts of Classes ====="); for (var i = 0; i < list.size(); i++) { if (i == 30) { break; } var elem = list.get(list.size() - 1 - i); - log.log( - Level.FINE, - " {0} {1} {2}", - new Object[] {elem.getValue()[0], elem.getValue()[1], elem.getKey().getName()}); + log.debug( + " " + elem.getValue()[0] + " " + elem.getValue()[1] + " " + elem.getKey().getName()); } } diff --git a/lib/java/persistance/src/main/java/org/enso/persist/PerInputImpl.java b/lib/java/persistance/src/main/java/org/enso/persist/PerInputImpl.java index d31165069e60..cf48f24ef482 100644 --- a/lib/java/persistance/src/main/java/org/enso/persist/PerInputImpl.java +++ b/lib/java/persistance/src/main/java/org/enso/persist/PerInputImpl.java @@ -9,7 +9,6 @@ import java.util.Map; import java.util.Objects; import java.util.function.Function; -import java.util.logging.Level; import org.enso.persist.Persistance.Input; import org.enso.persist.Persistance.Reference; @@ -213,7 +212,7 @@ static Object readIndirect(InputCache cache, PerMap map, Input in) throws IOExce sb.append("\nare they equal: ").append(bothObjectsAreTheSame); var ex = new IOException(sb.toString()); if (bothObjectsAreTheSame) { - PerUtils.LOG.log(Level.WARNING, sb.toString(), ex); + PerUtils.LOG.warn(sb.toString(), ex); } else { throw raise(RuntimeException.class, ex); } diff --git a/lib/java/persistance/src/main/java/org/enso/persist/PerUtils.java b/lib/java/persistance/src/main/java/org/enso/persist/PerUtils.java index f16779b7e03a..62f433571df6 100644 --- a/lib/java/persistance/src/main/java/org/enso/persist/PerUtils.java +++ b/lib/java/persistance/src/main/java/org/enso/persist/PerUtils.java @@ -1,11 +1,12 @@ package org.enso.persist; -import java.util.logging.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; final class PerUtils { private PerUtils() {} - static final Logger LOG = Logger.getLogger(Persistance.class.getPackageName()); + static final Logger LOG = LoggerFactory.getLogger(Persistance.class.getPackageName()); @SuppressWarnings("unchecked") static E raise(Class clazz, Throwable t) throws E {