diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java index 11e064b1b5..d1ea0688fb 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java @@ -29,6 +29,8 @@ import java.io.InvalidObjectException; import java.io.ObjectInputStream; import java.io.Serializable; +import java.lang.System.Logger; +import java.lang.System.Logger.Level; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; @@ -65,8 +67,6 @@ import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; -import java.util.logging.Level; -import java.util.logging.Logger; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; @@ -181,7 +181,7 @@ abstract class BoundedLocalCache extends BLCHeader.DrainStatusRef * http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf */ - static final Logger logger = Logger.getLogger(BoundedLocalCache.class.getName()); + static final Logger logger = System.getLogger(BoundedLocalCache.class.getName()); /** The number of CPUs */ static final int NCPU = Runtime.getRuntime().availableProcessors(); @@ -338,7 +338,7 @@ public void notifyRemoval(@Nullable K key, @Nullable V value, RemovalCause cause try { executor.execute(task); } catch (Throwable t) { - logger.log(Level.SEVERE, "Exception thrown when submitting removal listener", t); + logger.log(Level.ERROR, "Exception thrown when submitting removal listener", t); task.run(); } } @@ -1241,7 +1241,7 @@ void refreshIfNeeded(Node node, long now) { }); } catch (Throwable t) { node.casWriteTime(refreshWriteTime, oldWriteTime); - logger.log(Level.SEVERE, "Exception thrown when submitting refresh task", t); + logger.log(Level.ERROR, "Exception thrown when submitting refresh task", t); } } } @@ -1371,7 +1371,7 @@ void afterWrite(Runnable task) { try { performCleanUp(task); } catch (RuntimeException e) { - logger.log(Level.SEVERE, "Exception thrown when performing the maintenance task", e); + logger.log(Level.ERROR, "Exception thrown when performing the maintenance task", e); } } else { scheduleAfterWrite(); @@ -1437,7 +1437,7 @@ public void cleanUp() { try { performCleanUp(/* ignored */ null); } catch (RuntimeException e) { - logger.log(Level.SEVERE, "Exception thrown when performing the maintenance task", e); + logger.log(Level.ERROR, "Exception thrown when performing the maintenance task", e); } } @@ -3309,7 +3309,7 @@ public boolean exec() { try { run(); } catch (Throwable t) { - logger.log(Level.SEVERE, "Exception thrown when performing the maintenance task", t); + logger.log(Level.ERROR, "Exception thrown when performing the maintenance task", t); } // Indicates that the task has not completed to allow subsequent submissions to execute diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java index d50dd424a0..9bc1c721d7 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java @@ -19,6 +19,8 @@ import static java.util.Objects.requireNonNull; import java.io.Serializable; +import java.lang.System.Logger; +import java.lang.System.Logger.Level; import java.lang.ref.SoftReference; import java.lang.ref.WeakReference; import java.time.Duration; @@ -33,8 +35,6 @@ import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; -import java.util.logging.Level; -import java.util.logging.Logger; import org.checkerframework.checker.index.qual.NonNegative; import org.checkerframework.checker.nullness.qual.NonNull; @@ -137,7 +137,7 @@ * #removalListener} */ public final class Caffeine { - static final Logger logger = Logger.getLogger(Caffeine.class.getName()); + static final Logger logger = System.getLogger(Caffeine.class.getName()); static final Supplier ENABLED_STATS_COUNTER_SUPPLIER = ConcurrentStatsCounter::new; enum Strength { WEAK, SOFT } diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LoadingCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LoadingCache.java index 63dd489346..c0db010547 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LoadingCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LoadingCache.java @@ -96,7 +96,7 @@ public interface LoadingCache extends Cache { * previous value (if any) will continue to be returned by {@code get(key)} unless it is evicted. * If the new value is loaded successfully it will replace the previous value in the cache; if an * exception is thrown while refreshing the previous value will remain, and the exception will - * be logged (using {@link java.util.logging.Logger}) and swallowed. + * be logged (using {@link System.Logger}) and swallowed. *

* Caches loaded by a {@link CacheLoader} will call {@link CacheLoader#reload} if the cache * currently contains a value for the {@code key}, and {@link CacheLoader#load} otherwise. Loading diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java index 48ce3a9743..18b57f6167 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java @@ -18,6 +18,8 @@ import static java.util.Objects.requireNonNull; import java.io.Serializable; +import java.lang.System.Logger; +import java.lang.System.Logger.Level; import java.util.AbstractCollection; import java.util.AbstractMap; import java.util.AbstractSet; @@ -39,8 +41,6 @@ import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.Function; -import java.util.logging.Level; -import java.util.logging.Logger; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; @@ -55,7 +55,7 @@ * @author ben.manes@gmail.com (Ben Manes) */ interface LocalAsyncCache extends AsyncCache { - Logger logger = Logger.getLogger(LocalAsyncCache.class.getName()); + Logger logger = System.getLogger(LocalAsyncCache.class.getName()); /** Returns the backing {@link LocalCache} data store. */ LocalCache> cache(); diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncLoadingCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncLoadingCache.java index c3393a38a3..b11a7dc500 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncLoadingCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncLoadingCache.java @@ -17,14 +17,14 @@ import static java.util.Objects.requireNonNull; +import java.lang.System.Logger; +import java.lang.System.Logger.Level; import java.lang.reflect.Method; import java.util.LinkedHashMap; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.function.Function; -import java.util.logging.Level; -import java.util.logging.Logger; import org.checkerframework.checker.nullness.qual.Nullable; @@ -36,7 +36,7 @@ */ abstract class LocalAsyncLoadingCache implements LocalAsyncCache, AsyncLoadingCache { - static final Logger logger = Logger.getLogger(LocalAsyncLoadingCache.class.getName()); + static final Logger logger = System.getLogger(LocalAsyncLoadingCache.class.getName()); final boolean canBulkLoad; final AsyncCacheLoader loader; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalLoadingCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalLoadingCache.java index fd5361f994..b1192d294c 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalLoadingCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalLoadingCache.java @@ -17,6 +17,8 @@ import static java.util.Objects.requireNonNull; +import java.lang.System.Logger; +import java.lang.System.Logger.Level; import java.lang.reflect.Method; import java.util.Collections; import java.util.LinkedHashMap; @@ -26,8 +28,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import java.util.function.Function; -import java.util.logging.Level; -import java.util.logging.Logger; import org.checkerframework.checker.nullness.qual.Nullable; @@ -38,7 +38,7 @@ * @author ben.manes@gmail.com (Ben Manes) */ interface LocalLoadingCache extends LocalManualCache, LoadingCache { - Logger logger = Logger.getLogger(LocalLoadingCache.class.getName()); + Logger logger = System.getLogger(LocalLoadingCache.class.getName()); /** Returns the {@link CacheLoader} used by this cache. */ CacheLoader cacheLoader(); diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Scheduler.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Scheduler.java index 22af827592..091ad0e804 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Scheduler.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Scheduler.java @@ -18,6 +18,8 @@ import static java.util.Objects.requireNonNull; import java.io.Serializable; +import java.lang.System.Logger; +import java.lang.System.Logger.Level; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; @@ -25,8 +27,6 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import java.util.logging.Level; -import java.util.logging.Logger; import org.checkerframework.checker.index.qual.Positive; import org.checkerframework.checker.nullness.qual.NonNull; @@ -104,7 +104,7 @@ public Future schedule(Executor executor, Runnable command, long delay, TimeU } final class ExecutorServiceScheduler implements Scheduler, Serializable { - static final Logger logger = Logger.getLogger(ExecutorServiceScheduler.class.getName()); + static final Logger logger = System.getLogger(ExecutorServiceScheduler.class.getName()); static final long serialVersionUID = 1; final ScheduledExecutorService scheduledExecutorService; @@ -134,7 +134,7 @@ public Future schedule(Executor executor, Runnable command, long delay, TimeU } final class GuardedScheduler implements Scheduler, Serializable { - static final Logger logger = Logger.getLogger(GuardedScheduler.class.getName()); + static final Logger logger = System.getLogger(GuardedScheduler.class.getName()); static final long serialVersionUID = 1; final Scheduler delegate; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/GuardedStatsCounter.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/GuardedStatsCounter.java index 39ac2aa822..cbbd5c1185 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/GuardedStatsCounter.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/GuardedStatsCounter.java @@ -17,8 +17,8 @@ import static java.util.Objects.requireNonNull; -import java.util.logging.Level; -import java.util.logging.Logger; +import java.lang.System.Logger; +import java.lang.System.Logger.Level; import com.github.benmanes.caffeine.cache.RemovalCause; @@ -30,7 +30,7 @@ */ @SuppressWarnings("PMD.AvoidDuplicateLiterals") final class GuardedStatsCounter implements StatsCounter { - static final Logger logger = Logger.getLogger(GuardedStatsCounter.class.getName()); + static final Logger logger = System.getLogger(GuardedStatsCounter.class.getName()); final StatsCounter delegate;