From 7ef985145447559e215c8e975cb63b11de427500 Mon Sep 17 00:00:00 2001 From: Jorge Bescos Gascon Date: Wed, 22 May 2024 12:21:38 +0200 Subject: [PATCH] 4.x: Use System.Logger instead of JUL where applicable #7792 Signed-off-by: Jorge Bescos Gascon --- common/common/src/main/java/module-info.java | 5 +-- .../src/main/java/module-info.java | 3 +- .../helidon/config/etcd/EtcdConfigSource.java | 8 ++-- .../io/helidon/config/etcd/EtcdWatcher.java | 12 +++--- .../etcd/internal/client/v2/EtcdV2Client.java | 8 ++-- .../etcd/internal/client/v3/EtcdV3Client.java | 8 ++-- config/etcd/src/main/java/module-info.java | 4 +- config/hocon/src/main/java/module-info.java | 4 +- config/yaml/src/main/java/module-info.java | 4 +- .../main/java/io/helidon/cors/Aggregator.java | 3 +- .../io/helidon/cors/CorsSupportHelper.java | 6 +-- .../main/java/io/helidon/cors/LogHelper.java | 10 ++--- cors/src/main/java/module-info.java | 4 +- .../dbclient/src/main/java/module-info.java | 4 +- dbclient/jsonp/src/main/java/module-info.java | 4 +- helidon/src/main/java/module-info.java | 1 + .../integrations/common/rest/RestApiBase.java | 37 ++++++++--------- .../rest/src/main/java/module-info.java | 4 +- .../micronaut/cdi/MicronautCdiExtension.java | 10 ++--- .../micronaut/cdi/MicronautInterceptor.java | 7 ++-- .../cdi/MicronautMethodInvocationContext.java | 9 ++--- .../cdi/src/main/java/module-info.java | 4 +- .../neo4j/src/main/java/module-info.java | 4 +- .../oci/metrics/OciMetricsSupport.java | 24 +++++------ .../metrics/src/main/java/module-info.java | 2 +- .../vault/cdi/src/main/java/module-info.java | 4 +- .../cubbyhole/src/main/java/module-info.java | 4 +- .../database/src/main/java/module-info.java | 4 +- .../kv1/src/main/java/module-info.java | 4 +- .../kv2/src/main/java/module-info.java | 4 +- .../pki/src/main/java/module-info.java | 4 +- .../sys/sys/src/main/java/module-info.java | 4 +- jersey/common/src/main/java/module-info.java | 4 +- .../jersey/connector/HelidonConnector.java | 7 ++-- .../jersey/connector/ProxyBuilder.java | 5 ++- .../connector/src/main/java/module-info.java | 4 +- .../aq/src/main/java/module-info.java | 4 +- .../mock/src/main/java/module-info.java | 4 +- .../wls-jms/src/main/java/module-info.java | 4 +- .../cdi/src/main/java/module-info.java | 2 +- .../messaging/IncomingMethod.java | 34 ++++++++-------- .../microprofile/messaging/LatestEmitter.java | 10 ++--- .../messaging/ProcessorMethod.java | 8 ++-- .../messaging/ProxySubscriber.java | 9 ++--- .../messaging/UniversalChannel.java | 9 ++--- .../core/src/main/java/module-info.java | 4 +- .../health/src/main/java/module-info.java | 4 +- .../metrics/src/main/java/module-info.java | 4 +- .../oidc/src/main/java/module-info.java | 4 +- .../src/main/java/module-info.java | 2 +- .../telemetry/src/main/java/module-info.java | 2 +- .../common/src/main/java/module-info.java | 4 +- .../security/DefaultAuditProvider.java | 40 +++++++++---------- .../io/helidon/security/ProviderRequest.java | 13 +++--- .../io/helidon/security/SecurityImpl.java | 8 ++-- .../io/helidon/security/SecurityUtil.java | 13 +++--- .../security/src/main/java/module-info.java | 4 +- .../src/main/java/module-info.java | 4 +- .../src/main/java/module-info.java | 4 +- .../mp-3/src/main/java/module-info.java | 4 +- .../src/main/java/module-info.java | 4 +- .../zipkin/src/main/java/module-info.java | 2 +- .../graphql/src/main/java/module-info.java | 4 +- webserver/grpc/src/main/java/module-info.java | 2 +- .../log/src/main/java/module-info.java | 4 +- .../webserver/security/SecurityHandler.java | 12 +++--- .../security/SecurityHttpFeature.java | 5 +-- .../security/src/main/java/module-info.java | 4 +- 68 files changed, 218 insertions(+), 254 deletions(-) diff --git a/common/common/src/main/java/module-info.java b/common/common/src/main/java/module-info.java index 8fe413c98fb..1d5aa9bc24a 100644 --- a/common/common/src/main/java/module-info.java +++ b/common/common/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * Copyright (c) 2017, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,6 @@ */ module io.helidon.common { - // used only by LogConfig - requires java.logging; - exports io.helidon.common; } diff --git a/common/configurable/src/main/java/module-info.java b/common/configurable/src/main/java/module-info.java index d1e4a92b150..80856ad1bf6 100644 --- a/common/configurable/src/main/java/module-info.java +++ b/common/configurable/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * Copyright (c) 2018, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ requires io.helidon.builder.api; requires io.helidon.common.context; requires java.management; + requires java.logging; requires transitive io.helidon.common.config; requires transitive io.helidon.common; diff --git a/config/etcd/src/main/java/io/helidon/config/etcd/EtcdConfigSource.java b/config/etcd/src/main/java/io/helidon/config/etcd/EtcdConfigSource.java index a29c42131c0..281a51bfaad 100644 --- a/config/etcd/src/main/java/io/helidon/config/etcd/EtcdConfigSource.java +++ b/config/etcd/src/main/java/io/helidon/config/etcd/EtcdConfigSource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. + * Copyright (c) 2017, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,6 @@ import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Optional; -import java.util.logging.Level; -import java.util.logging.Logger; import io.helidon.common.media.type.MediaType; import io.helidon.common.media.type.MediaTypes; @@ -51,7 +49,7 @@ public class EtcdConfigSource extends AbstractConfigSource implements PollableSource, WatchableSource, ParsableSource { - private static final Logger LOGGER = Logger.getLogger(EtcdConfigSource.class.getName()); + private static final System.Logger LOGGER = System.getLogger(EtcdConfigSource.class.getName()); private final EtcdEndpoint endpoint; private final List endpoints; @@ -119,7 +117,7 @@ public Optional load() throws ConfigException { try { content = etcdClient().get(endpoint.key()); } catch (EtcdClientException e) { - LOGGER.log(Level.FINEST, "Get operation threw an exception.", e); + LOGGER.log(System.Logger.Level.TRACE, "Get operation threw an exception.", e); throw new ConfigException(String.format("Could not get data for key '%s'", endpoint.key()), e); } diff --git a/config/etcd/src/main/java/io/helidon/config/etcd/EtcdWatcher.java b/config/etcd/src/main/java/io/helidon/config/etcd/EtcdWatcher.java index b642ff46a46..f9fe4021b52 100644 --- a/config/etcd/src/main/java/io/helidon/config/etcd/EtcdWatcher.java +++ b/config/etcd/src/main/java/io/helidon/config/etcd/EtcdWatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020 Oracle and/or its affiliates. + * Copyright (c) 2017, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,6 @@ import java.util.concurrent.Flow; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; -import java.util.logging.Level; -import java.util.logging.Logger; import io.helidon.config.Config; import io.helidon.config.etcd.EtcdConfigSourceBuilder.EtcdEndpoint; @@ -34,7 +32,7 @@ */ public class EtcdWatcher implements ChangeWatcher { - private static final Logger LOGGER = Logger.getLogger(EtcdWatcher.class.getName()); + private static final System.Logger LOGGER = System.getLogger(EtcdWatcher.class.getName()); private final AtomicBoolean started = new AtomicBoolean(); @@ -80,7 +78,7 @@ public void start(EtcdEndpoint endpoint, Consumer> lis Flow.Publisher watchPublisher = etcdClient().watch(endpoint.key()); watchPublisher.subscribe(new EtcdWatchSubscriber(listener, endpoint)); } catch (EtcdClientException ex) { - LOGGER.log(Level.WARNING, String.format("Subscription on watching on '%s' key has failed. " + LOGGER.log(System.Logger.Level.WARNING, String.format("Subscription on watching on '%s' key has failed. " + "Watching by '%s' polling strategy will not start.", EtcdWatcher.this.endpoint.key(), EtcdWatcher.this), ex); @@ -96,7 +94,7 @@ public void stop() { try { this.etcdClient.close(); } catch (EtcdClientException e) { - LOGGER.log(Level.FINE, "Faield to close etcd client", e); + LOGGER.log(System.Logger.Level.TRACE, "Faield to close etcd client", e); } } @@ -142,7 +140,7 @@ public void onNext(Long item) { @Override public void onError(Throwable throwable) { - LOGGER.log(Level.WARNING, + LOGGER.log(System.Logger.Level.WARNING, String.format( "Watching on '%s' key has failed. Watching will not continue. ", endpoint.key()), diff --git a/config/etcd/src/main/java/io/helidon/config/etcd/internal/client/v2/EtcdV2Client.java b/config/etcd/src/main/java/io/helidon/config/etcd/internal/client/v2/EtcdV2Client.java index 4f0a563dc00..a56f474cd09 100644 --- a/config/etcd/src/main/java/io/helidon/config/etcd/internal/client/v2/EtcdV2Client.java +++ b/config/etcd/src/main/java/io/helidon/config/etcd/internal/client/v2/EtcdV2Client.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * Copyright (c) 2017, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,6 @@ import java.util.concurrent.SubmissionPublisher; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import java.util.logging.Level; -import java.util.logging.Logger; import io.helidon.config.etcd.internal.client.EtcdClient; import io.helidon.config.etcd.internal.client.EtcdClientException; @@ -45,7 +43,7 @@ public class EtcdV2Client implements EtcdClient { - private static final Logger LOGGER = Logger.getLogger(EtcdV2Client.class.getName()); + private static final System.Logger LOGGER = System.getLogger(EtcdV2Client.class.getName()); private final Map> publishers = new ConcurrentHashMap<>(); private final mousio.etcd4j.EtcdClient etcd; @@ -150,7 +148,7 @@ public void onResponse(ResponsePromise responsePromise) { publisher.submit(modifiedIndex); waitForChange(modifiedIndex + 1); } catch (Exception e) { - LOGGER.log(Level.CONFIG, "Cannot read changed value.", e); + LOGGER.log(System.Logger.Level.INFO, "Cannot read changed value.", e); } } diff --git a/config/etcd/src/main/java/io/helidon/config/etcd/internal/client/v3/EtcdV3Client.java b/config/etcd/src/main/java/io/helidon/config/etcd/internal/client/v3/EtcdV3Client.java index f9923af0609..87ad55feeac 100644 --- a/config/etcd/src/main/java/io/helidon/config/etcd/internal/client/v3/EtcdV3Client.java +++ b/config/etcd/src/main/java/io/helidon/config/etcd/internal/client/v3/EtcdV3Client.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. + * Copyright (c) 2017, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,6 @@ import java.util.concurrent.Flow; import java.util.concurrent.SubmissionPublisher; import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; import io.helidon.config.etcd.internal.client.EtcdClient; import io.helidon.config.etcd.internal.client.EtcdClientException; @@ -48,7 +46,7 @@ */ public class EtcdV3Client implements EtcdClient { - private static final Logger LOGGER = Logger.getLogger(EtcdV3Client.class.getName()); + private static final System.Logger LOGGER = System.getLogger(EtcdV3Client.class.getName()); private final Map> publishers = new ConcurrentHashMap<>(); @@ -148,7 +146,7 @@ public void close() throws EtcdClientException { try { channel.awaitTermination(1, TimeUnit.SECONDS); } catch (InterruptedException e) { - LOGGER.log(Level.CONFIG, "Error closing gRPC channel, reason: " + e.getLocalizedMessage(), e); + LOGGER.log(System.Logger.Level.INFO, "Error closing gRPC channel, reason: " + e.getLocalizedMessage(), e); } finally { channel.shutdown(); } diff --git a/config/etcd/src/main/java/module-info.java b/config/etcd/src/main/java/module-info.java index 5df7ecc5899..83f855d6782 100644 --- a/config/etcd/src/main/java/module-info.java +++ b/config/etcd/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * Copyright (c) 2017, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ requires io.grpc.stub; requires io.helidon.common.media.type; requires io.helidon.common; - requires java.logging; + requires static java.annotation; diff --git a/config/hocon/src/main/java/module-info.java b/config/hocon/src/main/java/module-info.java index 147479b2347..ac6e09d3cc5 100644 --- a/config/hocon/src/main/java/module-info.java +++ b/config/hocon/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * Copyright (c) 2017, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ module io.helidon.config.hocon { requires io.helidon.common; - requires java.logging; + requires typesafe.config; requires static io.helidon.common.features.api; diff --git a/config/yaml/src/main/java/module-info.java b/config/yaml/src/main/java/module-info.java index f4189cb3adc..921b20e2f13 100644 --- a/config/yaml/src/main/java/module-info.java +++ b/config/yaml/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * Copyright (c) 2017, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ module io.helidon.config.yaml { requires io.helidon.common; - requires java.logging; + requires org.yaml.snakeyaml; requires static io.helidon.common.features.api; diff --git a/cors/src/main/java/io/helidon/cors/Aggregator.java b/cors/src/main/java/io/helidon/cors/Aggregator.java index 64f8b5b96a1..f3d440fb4b2 100644 --- a/cors/src/main/java/io/helidon/cors/Aggregator.java +++ b/cors/src/main/java/io/helidon/cors/Aggregator.java @@ -20,7 +20,6 @@ import java.util.Optional; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Supplier; -import java.util.logging.Logger; import io.helidon.common.config.Config; import io.helidon.common.config.ConfigValue; @@ -53,7 +52,7 @@ public class Aggregator { */ public static final String PATHLESS_KEY = "{+}"; - private static final Logger LOGGER = Logger.getLogger(Aggregator.class.getName()); + private static final System.Logger LOGGER = System.getLogger(Aggregator.class.getName()); // Records paths and configs added via addCrossOriginConfig private final List crossOriginConfigMatchables = new ArrayList<>(); diff --git a/cors/src/main/java/io/helidon/cors/CorsSupportHelper.java b/cors/src/main/java/io/helidon/cors/CorsSupportHelper.java index ed4c9207f26..51d6b753ad1 100644 --- a/cors/src/main/java/io/helidon/cors/CorsSupportHelper.java +++ b/cors/src/main/java/io/helidon/cors/CorsSupportHelper.java @@ -26,7 +26,6 @@ import java.util.StringTokenizer; import java.util.function.BiFunction; import java.util.function.Supplier; -import java.util.logging.Logger; import io.helidon.common.config.Config; import io.helidon.common.uri.UriInfo; @@ -59,7 +58,7 @@ public class CorsSupportHelper { static final String METHOD_NOT_IN_ALLOWED_LIST = "CORS method is not in allowed list"; static final String HEADERS_NOT_IN_ALLOWED_LIST = "CORS headers not in allowed list"; - static final Logger LOGGER = Logger.getLogger(CorsSupportHelper.class.getName()); + static final System.Logger LOGGER = System.getLogger(CorsSupportHelper.class.getName()); static final String OPAQUE_ORIGIN = "null"; // browsers might send this as Origin header if origin info is untrusted @@ -240,7 +239,8 @@ public CorsSupportHelper build() { CorsSupportHelper result = new CorsSupportHelper<>(this); - LOGGER.config(() -> String.format("CorsSupportHelper configured as: %s", result.toString())); + LOGGER.log(System.Logger.Level.INFO, + () -> String.format("CorsSupportHelper configured as: %s", result.toString())); return result; } diff --git a/cors/src/main/java/io/helidon/cors/LogHelper.java b/cors/src/main/java/io/helidon/cors/LogHelper.java index 3b121a83874..7b6a2dc72a7 100644 --- a/cors/src/main/java/io/helidon/cors/LogHelper.java +++ b/cors/src/main/java/io/helidon/cors/LogHelper.java @@ -25,8 +25,6 @@ import java.util.StringJoiner; import java.util.function.BiConsumer; import java.util.function.Function; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.stream.Collectors; import io.helidon.cors.CorsSupportHelper.RequestType; @@ -36,8 +34,8 @@ class LogHelper { - static final Level DECISION_LEVEL = Level.FINE; - static final Level DETAILED_DECISION_LEVEL = Level.FINER; + static final System.Logger.Level DECISION_LEVEL = System.Logger.Level.TRACE; + static final System.Logger.Level DETAILED_DECISION_LEVEL = System.Logger.Level.TRACE; private LogHelper() { } @@ -177,11 +175,11 @@ static void logInferRequestType(RequestType result, static class MatcherChecks { private final Map checks; - private final Logger logger; + private final System.Logger logger; private final boolean isLoggable; private final Function getter; - MatcherChecks(Logger logger, Function getter) { + MatcherChecks(System.Logger logger, Function getter) { this.logger = logger; isLoggable = logger.isLoggable(DETAILED_DECISION_LEVEL); this.getter = getter; diff --git a/cors/src/main/java/module-info.java b/cors/src/main/java/module-info.java index 7250dc96191..00ae6c5787d 100644 --- a/cors/src/main/java/module-info.java +++ b/cors/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * Copyright (c) 2022, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ */ module io.helidon.cors { - requires java.logging; + requires io.helidon.http; requires io.helidon.common.config; diff --git a/dbclient/dbclient/src/main/java/module-info.java b/dbclient/dbclient/src/main/java/module-info.java index ea1963549b8..5fa0f330082 100644 --- a/dbclient/dbclient/src/main/java/module-info.java +++ b/dbclient/dbclient/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023 Oracle and/or its affiliates. + * Copyright (c) 2019, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ ) module io.helidon.dbclient { - requires java.logging; + requires java.sql; requires static io.helidon.common.features.api; diff --git a/dbclient/jsonp/src/main/java/module-info.java b/dbclient/jsonp/src/main/java/module-info.java index 771f3f1fc34..797ca0ce5e1 100644 --- a/dbclient/jsonp/src/main/java/module-info.java +++ b/dbclient/jsonp/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023 Oracle and/or its affiliates. + * Copyright (c) 2019, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ requires io.helidon.dbclient; requires jakarta.json; - requires java.logging; + requires static io.helidon.common.features.api; exports io.helidon.dbclient.jsonp; diff --git a/helidon/src/main/java/module-info.java b/helidon/src/main/java/module-info.java index 183e82b9223..f31b171f821 100644 --- a/helidon/src/main/java/module-info.java +++ b/helidon/src/main/java/module-info.java @@ -21,6 +21,7 @@ // this is required due to a bug in JDK (see Main for details and link) requires java.logging; + requires io.helidon.common; requires io.helidon.logging.common; diff --git a/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/RestApiBase.java b/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/RestApiBase.java index 89e8856cda6..a90d4983743 100644 --- a/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/RestApiBase.java +++ b/integrations/common/rest/src/main/java/io/helidon/integrations/common/rest/RestApiBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * Copyright (c) 2021, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,13 @@ import java.io.IOException; import java.io.InputStream; import java.io.StringReader; +import java.lang.System.Logger; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.UUID; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Supplier; -import java.util.logging.Logger; import io.helidon.common.context.Contexts; import io.helidon.common.media.type.MediaType; @@ -51,7 +51,7 @@ * such as security, processing of headers etc. */ public abstract class RestApiBase implements RestApi { - private static final Logger LOGGER = Logger.getLogger(RestApiBase.class.getName()); + private static final System.Logger LOGGER = System.getLogger(RestApiBase.class.getName()); private final WebClient webClient; private final FtHandler ftHandler; private final JsonBuilderFactory jsonBuilderFactory; @@ -78,7 +78,7 @@ public T invoke(Method method, ApiResponse.Builder responseBuilder) { String requestId = requestId(request); - LOGGER.finest(() -> requestId + ": Invoking " + method + " on path " + path + " no entity expected."); + LOGGER.log(Logger.Level.TRACE, () -> requestId + ": Invoking " + method + " on path " + path + " no entity expected."); HttpClientResponse response = ftHandler.invoke(responseSupplier(method, path, request, requestId)); return handleResponse(path, request, method, requestId, response, responseBuilder); @@ -91,7 +91,7 @@ public T invokeWithResponse(Method method, ApiEntityResponse.Builder responseBuilder) { String requestId = requestId(request); - LOGGER.finest(() -> requestId + ": Invoking " + method + " on path " + path + " JSON entity expected."); + LOGGER.log(Logger.Level.TRACE, () -> requestId + ": Invoking " + method + " on path " + path + " JSON entity expected."); Supplier responseSupplier = responseSupplier(method, path, request, requestId); @@ -108,7 +108,7 @@ public T invokeBytesRequest(Method method, String requestId = requestId(apiRequest); - LOGGER.finest(() -> requestId + ": Invoking " + method + " on path " + path + " with bytes request"); + LOGGER.log(Logger.Level.TRACE, () -> requestId + ": Invoking " + method + " on path " + path + " with bytes request"); HttpClientRequest request = webClient.method(method).path(path); addHeaders(request, apiRequest.headers()); @@ -134,7 +134,7 @@ public > T invokeEntityResponse(Method metho String requestId = requestId(request); - LOGGER.finest(() -> requestId + ": Invoking " + method + " on path " + path + " with publisher response"); + LOGGER.log(Logger.Level.TRACE, () -> requestId + ": Invoking " + method + " on path " + path + " with publisher response"); request.responseMediaType(request.responseMediaType().orElse(MediaTypes.WILDCARD)); HttpClientResponse response = ftHandler.invoke(responseSupplier(method, path, request, requestId)); @@ -149,7 +149,7 @@ public > T invokeBytesResponse(Method method String requestId = requestId(request); - LOGGER.finest(() -> requestId + ": Invoking " + method + " on path " + path + " with bytes response"); + LOGGER.log(Logger.Level.TRACE, () -> requestId + ": Invoking " + method + " on path " + path + " with bytes response"); request.responseMediaType(request.responseMediaType().orElse(MediaTypes.WILDCARD)); @@ -166,7 +166,7 @@ public > T invokeOptional(Method method, String requestId = requestId(request); - LOGGER.finest(() -> requestId + ": Invoking " + method + " on path " + path + " with optional response"); + LOGGER.log(Logger.Level.TRACE, () -> requestId + ": Invoking " + method + " on path " + path + " with optional response"); HttpClientResponse response = ftHandler.invoke(responseSupplier(method, path, request, requestId)); return handleOptionalJsonResponse(path, request, method, requestId, response, responseBuilder); @@ -401,7 +401,8 @@ protected > T handleOptionalJsonResponse( ResponseState statusKind = responseState(path, request, method, requestId, response); if (statusKind.success) { if (statusKind.entityExpected) { - LOGGER.finest(() -> requestId + ": " + method + " on path " + path + " returned " + response.status()); + LOGGER.log(Logger.Level.TRACE, + () -> requestId + ": " + method + " on path " + path + " returned " + response.status()); if (response.headers().contentLength().orElse(-1L) == 0) { // explicit content length set to 0 return emptyResponse(path, request, method, requestId, response, responseBuilder); @@ -416,7 +417,7 @@ protected > T handleOptionalJsonResponse( } return emptyResponse(path, request, method, requestId, response, responseBuilder); } - LOGGER.finest(() -> requestId + ": " + method + " on path " + path + " failed " + response.status()); + LOGGER.log(Logger.Level.TRACE, () -> requestId + ": " + method + " on path " + path + " failed " + response.status()); throw responseError(path, request, method, requestId, response); } @@ -498,7 +499,7 @@ protected T handleJsonResponse( Status status = response.status(); if (Status.Family.of(status.code()) == Status.Family.SUCCESSFUL) { - LOGGER.finest(() -> requestId + ": " + method + " on path " + path + " returned " + status); + LOGGER.log(Logger.Level.TRACE, () -> requestId + ": " + method + " on path " + path + " returned " + status); try { JsonObject entity = response.entity().as(JsonObject.class); return jsonOkResponse(path, request, method, requestId, response, entity, responseBuilder); @@ -506,7 +507,7 @@ protected T handleJsonResponse( throw readErrorFailedEntity(path, request, method, requestId, response, ex); } } - LOGGER.finest(() -> requestId + ": " + method + " on path " + path + " failed " + status); + LOGGER.log(Logger.Level.TRACE, () -> requestId + ": " + method + " on path " + path + " failed " + status); throw responseError(path, request, method, requestId, response); } @@ -534,10 +535,10 @@ protected T handleResponse(String path, boolean success = (Status.Family.of(status.code()) == Status.Family.SUCCESSFUL); if (success) { - LOGGER.finest(() -> requestId + ": " + method + " on path " + path + " returned " + status); + LOGGER.log(Logger.Level.TRACE, () -> requestId + ": " + method + " on path " + path + " returned " + status); return noEntityOkResponse(path, request, method, requestId, response, responseBuilder); } - LOGGER.finest(() -> requestId + ": " + method + " on path " + path + " failed " + status); + LOGGER.log(Logger.Level.TRACE, () -> requestId + ": " + method + " on path " + path + " failed " + status); throw responseError(path, request, method, requestId, response); } @@ -622,7 +623,7 @@ protected ApiRestException readError(String path, String requestId, HttpClientResponse response, String entity) { - LOGGER.finest(() -> requestId + ": request failed for path " + path + ", error response: " + entity); + LOGGER.log(Logger.Level.TRACE, () -> requestId + ": request failed for path " + path + ", error response: " + entity); return RestException.builder() .requestId(requestId) @@ -648,7 +649,7 @@ protected ApiRestException readError(String path, Method method, String requestId, HttpClientResponse response) { - LOGGER.finest(() -> requestId + ": request failed for path " + path); + LOGGER.log(Logger.Level.TRACE, () -> requestId + ": request failed for path " + path); return RestException.builder() .requestId(requestId) @@ -676,7 +677,7 @@ protected ApiRestException readError(String path, String requestId, HttpClientResponse response, JsonObject errorObject) { - LOGGER.finest(() -> requestId + ": request failed for path " + path + ", error object: " + errorObject); + LOGGER.log(Logger.Level.TRACE, () -> requestId + ": request failed for path " + path + ", error object: " + errorObject); return RestException.builder() .requestId(requestId) .status(response.status()) diff --git a/integrations/common/rest/src/main/java/module-info.java b/integrations/common/rest/src/main/java/module-info.java index 392fe2eff69..0b4d8cb4ae7 100644 --- a/integrations/common/rest/src/main/java/module-info.java +++ b/integrations/common/rest/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * Copyright (c) 2021, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ requires io.helidon.http.media.jsonp; requires io.helidon.tracing; requires io.helidon.webclient; - requires java.logging; + requires transitive io.helidon.common; requires transitive jakarta.json; diff --git a/integrations/micronaut/cdi/src/main/java/io/helidon/integrations/micronaut/cdi/MicronautCdiExtension.java b/integrations/micronaut/cdi/src/main/java/io/helidon/integrations/micronaut/cdi/MicronautCdiExtension.java index 9b234c3b6a7..b0979452eb6 100644 --- a/integrations/micronaut/cdi/src/main/java/io/helidon/integrations/micronaut/cdi/MicronautCdiExtension.java +++ b/integrations/micronaut/cdi/src/main/java/io/helidon/integrations/micronaut/cdi/MicronautCdiExtension.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,8 +28,6 @@ import java.util.Objects; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -69,7 +67,7 @@ * scope), and adds support for invoking Micronaut interceptors. */ public class MicronautCdiExtension implements Extension { - private static final Logger LOGGER = Logger.getLogger(MicronautCdiExtension.class.getName()); + private static final System.Logger LOGGER = System.getLogger(MicronautCdiExtension.class.getName()); private static final String MICRONAUT_BEAN_PREFIX = "micronaut-"; private final AtomicReference micronautContext = new AtomicReference<>(); @@ -340,8 +338,8 @@ private Stream loadMicronautService(ServiceDefinition next = remaining.next(); - LOGGER.finest(() -> "Micronaut interceptor: " + next.getClass().getName()); + LOGGER.log(System.Logger.Level.TRACE, () -> "Micronaut interceptor: " + next.getClass().getName()); return next.intercept(context); } } diff --git a/integrations/micronaut/cdi/src/main/java/io/helidon/integrations/micronaut/cdi/MicronautMethodInvocationContext.java b/integrations/micronaut/cdi/src/main/java/io/helidon/integrations/micronaut/cdi/MicronautMethodInvocationContext.java index 15c39f99ffc..6d32c1645c7 100644 --- a/integrations/micronaut/cdi/src/main/java/io/helidon/integrations/micronaut/cdi/MicronautMethodInvocationContext.java +++ b/integrations/micronaut/cdi/src/main/java/io/helidon/integrations/micronaut/cdi/MicronautMethodInvocationContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; -import java.util.logging.Logger; import io.helidon.common.LazyValue; @@ -43,7 +42,7 @@ */ @SuppressWarnings({"rawtypes", "unchecked"}) class MicronautMethodInvocationContext implements MethodInvocationContext { - private static final Logger LOGGER = Logger.getLogger(MicronautMethodInvocationContext.class.getName()); + private static final System.Logger LOGGER = System.getLogger(MicronautMethodInvocationContext.class.getName()); private final InvocationContext cdiContext; private final ExecutableMethod executableMethod; @@ -107,7 +106,7 @@ public Object getTarget() { public Object proceed() throws RuntimeException { if (remaining.hasNext()) { MethodInterceptor next = remaining.next(); - LOGGER.finest(() -> "Micronaut interceptor: " + next.getClass().getName()); + LOGGER.log(System.Logger.Level.TRACE, () -> "Micronaut interceptor: " + next.getClass().getName()); return next.intercept(this); } try { @@ -120,7 +119,7 @@ public Object proceed() throws RuntimeException { cdiContext.setParameters(arguments); } - LOGGER.finest(() -> "Proceeding with CDI interceptors"); + LOGGER.log(System.Logger.Level.TRACE, () -> "Proceeding with CDI interceptors"); return cdiContext.proceed(); } catch (RuntimeException e) { throw e; diff --git a/integrations/micronaut/cdi/src/main/java/module-info.java b/integrations/micronaut/cdi/src/main/java/module-info.java index 29ecde89f11..8425c8aeb60 100644 --- a/integrations/micronaut/cdi/src/main/java/module-info.java +++ b/integrations/micronaut/cdi/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ requires io.helidon.common; requires jakarta.inject; - requires java.logging; + requires microprofile.config.api; requires transitive io.micronaut.aop; diff --git a/integrations/neo4j/neo4j/src/main/java/module-info.java b/integrations/neo4j/neo4j/src/main/java/module-info.java index 74603920ff6..dc9b6974525 100644 --- a/integrations/neo4j/neo4j/src/main/java/module-info.java +++ b/integrations/neo4j/neo4j/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * Copyright (c) 2021, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ module io.helidon.integrations.neo4j { requires io.helidon.common; - requires java.logging; + requires static io.helidon.common.features.api; requires static io.helidon.config.metadata; diff --git a/integrations/oci/metrics/metrics/src/main/java/io/helidon/integrations/oci/metrics/OciMetricsSupport.java b/integrations/oci/metrics/metrics/src/main/java/io/helidon/integrations/oci/metrics/OciMetricsSupport.java index 67c1e5db5ab..cb9c8a3e5a3 100644 --- a/integrations/oci/metrics/metrics/src/main/java/io/helidon/integrations/oci/metrics/OciMetricsSupport.java +++ b/integrations/oci/metrics/metrics/src/main/java/io/helidon/integrations/oci/metrics/OciMetricsSupport.java @@ -25,8 +25,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; import io.helidon.config.Config; import io.helidon.config.metadata.Configured; @@ -49,7 +47,7 @@ * OCI Metrics Support. */ public class OciMetricsSupport implements HttpService { - private static final Logger LOGGER = Logger.getLogger(OciMetricsSupport.class.getName()); + private static final System.Logger LOGGER = System.getLogger(OciMetricsSupport.class.getName()); private static final UnitConverter STORAGE_UNIT_CONVERTER = UnitConverter.storageUnitConverter(); private static final UnitConverter TIME_UNIT_CONVERTER = UnitConverter.timeUnitConverter(); @@ -183,7 +181,7 @@ private void startExecutor() { private void pushMetrics() { List allMetricDataDetails = ociMetricsData.getMetricDataDetails(); - LOGGER.finest(String.format("Processing %d metrics", allMetricDataDetails.size())); + LOGGER.log(System.Logger.Level.TRACE, String.format("Processing %d metrics", allMetricDataDetails.size())); if (allMetricDataDetails.size() > 0) { while (true) { @@ -214,11 +212,11 @@ private void postBatch(List metricDataDetailsList) { .postMetricDataDetails(postMetricDataDetails) .build(); - LOGGER.finest(String.format("Pushing %d metrics to OCI", metricDataDetailsList.size())); - if (LOGGER.isLoggable(Level.FINEST)) { + LOGGER.log(System.Logger.Level.TRACE, String.format("Pushing %d metrics to OCI", metricDataDetailsList.size())); + if (LOGGER.isLoggable(System.Logger.Level.TRACE)) { metricDataDetailsList .forEach(m -> { - LOGGER.finest(String.format( + LOGGER.log(System.Logger.Level.TRACE, String.format( "Metric details: name=%s, namespace=%s, dimensions=%s, " + "datapoints.timestamp=%s, datapoints.value=%f, metadata=%s", m.getName(), @@ -235,9 +233,9 @@ private void postBatch(List metricDataDetailsList) { this.monitoringClient.setEndpoint( monitoringClient.getEndpoint().replaceFirst("telemetry\\.", "telemetry-ingestion.")); this.monitoringClient.postMetricData(postMetricDataRequest); - LOGGER.finest(String.format("Successfully posted %d metrics to OCI", metricDataDetailsList.size())); + LOGGER.log(System.Logger.Level.TRACE, String.format("Successfully posted %d metrics to OCI", metricDataDetailsList.size())); } catch (Throwable e) { - LOGGER.warning(String.format("Unable to send metrics to OCI: %s", e.getMessage())); + LOGGER.log(System.Logger.Level.WARNING, String.format("Unable to send metrics to OCI: %s", e.getMessage())); } finally { // restore original endpoint this.monitoringClient.setEndpoint(originalMonitoringEndpoint); @@ -252,16 +250,16 @@ public void routing(HttpRules rules) { @Override public void beforeStart() { if (!enabled) { - LOGGER.info("Metric push to OCI is disabled!"); + LOGGER.log(System.Logger.Level.INFO, "Metric push to OCI is disabled!"); return; } if (scopes.isEmpty()) { - LOGGER.info("No selected metric scopes to push to OCI"); + LOGGER.log(System.Logger.Level.INFO, "No selected metric scopes to push to OCI"); return; } - LOGGER.fine("Starting OCI Metrics agent"); + LOGGER.log(System.Logger.Level.TRACE, "Starting OCI Metrics agent"); ociMetricsData = new OciMetricsData( scopes, nameFormatter, compartmentId, namespace, resourceGroup, descriptionEnabled); @@ -272,7 +270,7 @@ public void beforeStart() { public void afterStop() { // Shutdown executor if created if (scheduledExecutorService != null) { - LOGGER.fine("Shutting down OCI Metrics agent"); + LOGGER.log(System.Logger.Level.TRACE, "Shutting down OCI Metrics agent"); scheduledExecutorService.shutdownNow(); } } diff --git a/integrations/oci/metrics/metrics/src/main/java/module-info.java b/integrations/oci/metrics/metrics/src/main/java/module-info.java index 81c1a943eaf..b676ecd1b67 100644 --- a/integrations/oci/metrics/metrics/src/main/java/module-info.java +++ b/integrations/oci/metrics/metrics/src/main/java/module-info.java @@ -21,7 +21,7 @@ module io.helidon.integrations.oci.metrics { requires io.helidon.http; - requires java.logging; + requires oci.java.sdk.common; requires static io.helidon.config.metadata; diff --git a/integrations/vault/cdi/src/main/java/module-info.java b/integrations/vault/cdi/src/main/java/module-info.java index 314e636fd2e..7bb6fed7a79 100644 --- a/integrations/vault/cdi/src/main/java/module-info.java +++ b/integrations/vault/cdi/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * Copyright (c) 2021, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ requires io.helidon.microprofile.cdi; requires jakarta.inject; - requires java.logging; + requires microprofile.config.api; requires transitive io.helidon.integrations.vault; diff --git a/integrations/vault/secrets/cubbyhole/src/main/java/module-info.java b/integrations/vault/secrets/cubbyhole/src/main/java/module-info.java index 3509e389654..9d75e16a8bc 100644 --- a/integrations/vault/secrets/cubbyhole/src/main/java/module-info.java +++ b/integrations/vault/secrets/cubbyhole/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * Copyright (c) 2021, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ module io.helidon.integrations.vault.secrets.cubbyhole { requires io.helidon.integrations.common.rest; - requires java.logging; + requires static io.helidon.common.features.api; diff --git a/integrations/vault/secrets/database/src/main/java/module-info.java b/integrations/vault/secrets/database/src/main/java/module-info.java index 2ee65ee7bfa..b3489d53dcf 100644 --- a/integrations/vault/secrets/database/src/main/java/module-info.java +++ b/integrations/vault/secrets/database/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * Copyright (c) 2021, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ ) module io.helidon.integrations.vault.secrets.database { - requires java.logging; + requires static io.helidon.common.features.api; diff --git a/integrations/vault/secrets/kv1/src/main/java/module-info.java b/integrations/vault/secrets/kv1/src/main/java/module-info.java index 60cacf8f706..317eca385ee 100644 --- a/integrations/vault/secrets/kv1/src/main/java/module-info.java +++ b/integrations/vault/secrets/kv1/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * Copyright (c) 2021, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ module io.helidon.integrations.vault.secrets.kvone { requires io.helidon.integrations.common.rest; - requires java.logging; + requires static io.helidon.common.features.api; diff --git a/integrations/vault/secrets/kv2/src/main/java/module-info.java b/integrations/vault/secrets/kv2/src/main/java/module-info.java index 9c4c27156d7..11c3a138226 100644 --- a/integrations/vault/secrets/kv2/src/main/java/module-info.java +++ b/integrations/vault/secrets/kv2/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * Copyright (c) 2021, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ requires io.helidon.http; requires io.helidon.integrations.common.rest; - requires java.logging; + requires static io.helidon.common.features.api; diff --git a/integrations/vault/secrets/pki/src/main/java/module-info.java b/integrations/vault/secrets/pki/src/main/java/module-info.java index 7a4de93f25d..2891f903c34 100644 --- a/integrations/vault/secrets/pki/src/main/java/module-info.java +++ b/integrations/vault/secrets/pki/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * Copyright (c) 2021, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ requires io.helidon.http; requires io.helidon.integrations.common.rest; - requires java.logging; + requires static io.helidon.common.features.api; diff --git a/integrations/vault/sys/sys/src/main/java/module-info.java b/integrations/vault/sys/sys/src/main/java/module-info.java index ef1db3e5e3a..8e928809967 100644 --- a/integrations/vault/sys/sys/src/main/java/module-info.java +++ b/integrations/vault/sys/sys/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023 Oracle and/or its affiliates. + * Copyright (c) 2021, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ requires io.helidon.integrations.common.rest; requires io.helidon.integrations.vault.auths.common; - requires java.logging; + requires static io.helidon.common.features.api; diff --git a/jersey/common/src/main/java/module-info.java b/jersey/common/src/main/java/module-info.java index 5ecbd6f4ea5..52788e0c2ef 100644 --- a/jersey/common/src/main/java/module-info.java +++ b/jersey/common/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ requires io.helidon.common; requires jakarta.annotation; requires jakarta.ws.rs; - requires java.logging; + requires jersey.common; requires jersey.server; diff --git a/jersey/connector/src/main/java/io/helidon/jersey/connector/HelidonConnector.java b/jersey/connector/src/main/java/io/helidon/jersey/connector/HelidonConnector.java index ae407b707ff..59c83627782 100644 --- a/jersey/connector/src/main/java/io/helidon/jersey/connector/HelidonConnector.java +++ b/jersey/connector/src/main/java/io/helidon/jersey/connector/HelidonConnector.java @@ -24,7 +24,6 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import java.util.logging.Logger; import io.helidon.common.LazyValue; import io.helidon.common.Version; @@ -62,7 +61,7 @@ import static org.glassfish.jersey.client.ClientProperties.getValue; class HelidonConnector implements Connector { - static final Logger LOGGER = Logger.getLogger(HelidonConnector.class.getName()); + static final System.Logger LOGGER = System.getLogger(HelidonConnector.class.getName()); private static final int DEFAULT_TIMEOUT = 10000; private static final Map EMPTY_MAP_LIST = Map.of("", ""); @@ -308,8 +307,8 @@ static Optional helidonConfig(Configuration configuration) { Object helidonConfig = configuration.getProperty(HelidonProperties.CONFIG); if (helidonConfig != null) { if (!(helidonConfig instanceof Config)) { - LOGGER.warning(String.format("Ignoring Helidon Connector config at '%s'", - HelidonProperties.CONFIG)); + LOGGER.log(System.Logger.Level.WARNING, + String.format("Ignoring Helidon Connector config at '%s'", HelidonProperties.CONFIG)); } else { return Optional.of((Config) helidonConfig); } diff --git a/jersey/connector/src/main/java/io/helidon/jersey/connector/ProxyBuilder.java b/jersey/connector/src/main/java/io/helidon/jersey/connector/ProxyBuilder.java index 88599d35b34..0f6ac3faae4 100644 --- a/jersey/connector/src/main/java/io/helidon/jersey/connector/ProxyBuilder.java +++ b/jersey/connector/src/main/java/io/helidon/jersey/connector/ProxyBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Oracle and/or its affiliates. + * Copyright (c) 2023, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,7 +61,8 @@ private static Optional createProxy(Object proxyUri, String userName, Str if ("HTTP".equals(u.getScheme().toUpperCase(Locale.ROOT))) { builder.type(Proxy.ProxyType.HTTP); } else { - HelidonConnector.LOGGER.warning(String.format("Proxy schema %s not supported.", u.getScheme())); + HelidonConnector.LOGGER.log(System.Logger.Level.WARNING, + String.format("Proxy schema %s not supported.", u.getScheme())); return Optional.empty(); } } diff --git a/jersey/connector/src/main/java/module-info.java b/jersey/connector/src/main/java/module-info.java index bf224a1f102..3e124745226 100644 --- a/jersey/connector/src/main/java/module-info.java +++ b/jersey/connector/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ requires io.helidon.webclient; requires io.helidon.webclient.http2; requires jakarta.ws.rs; - requires java.logging; + requires jersey.common; requires transitive jersey.client; diff --git a/messaging/connectors/aq/src/main/java/module-info.java b/messaging/connectors/aq/src/main/java/module-info.java index 72e12d14b96..29a396aa4fd 100644 --- a/messaging/connectors/aq/src/main/java/module-info.java +++ b/messaging/connectors/aq/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ requires aqapi; requires io.helidon.common.configurable; requires io.helidon.messaging.jms.shim; - requires java.logging; + requires javax.jms.api; requires jakarta.messaging; diff --git a/messaging/connectors/mock/src/main/java/module-info.java b/messaging/connectors/mock/src/main/java/module-info.java index d1168f62462..c6130475355 100644 --- a/messaging/connectors/mock/src/main/java/module-info.java +++ b/messaging/connectors/mock/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ module helidon.messaging.mock { requires hamcrest.all; - requires java.logging; + requires microprofile.config.api; requires org.reactivestreams; diff --git a/messaging/connectors/wls-jms/src/main/java/module-info.java b/messaging/connectors/wls-jms/src/main/java/module-info.java index 8bf35414d07..7b0139bd613 100644 --- a/messaging/connectors/wls-jms/src/main/java/module-info.java +++ b/messaging/connectors/wls-jms/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * Copyright (c) 2022, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ requires io.helidon.messaging.connectors.jms; requires jakarta.messaging; - requires java.logging; + requires java.naming; requires static jakarta.cdi; diff --git a/microprofile/cdi/src/main/java/module-info.java b/microprofile/cdi/src/main/java/module-info.java index e996197c76d..3aacf8e17c5 100644 --- a/microprofile/cdi/src/main/java/module-info.java +++ b/microprofile/cdi/src/main/java/module-info.java @@ -39,7 +39,7 @@ requires io.helidon.config; requires io.helidon.logging.common; requires jakarta.el; // weld requires jakarta.el.ELResolver on module path - requires java.logging; + requires java.sql; // weld requires java.sql.Date and we fail if not on classpath requires jdk.unsupported; // needed for Unsafe used from Weld requires microprofile.config.api; diff --git a/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/IncomingMethod.java b/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/IncomingMethod.java index 6ca7666e20b..4dcc0d2c48a 100644 --- a/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/IncomingMethod.java +++ b/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/IncomingMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,6 @@ import java.lang.reflect.Method; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; -import java.util.logging.Level; -import java.util.logging.Logger; import io.helidon.common.Errors; import io.helidon.config.Config; @@ -45,7 +43,7 @@ */ class IncomingMethod extends AbstractMessagingMethod implements IncomingMember { - private static final Logger LOGGER = Logger.getLogger(IncomingMethod.class.getName()); + private static final System.Logger LOGGER = System.getLogger(IncomingMethod.class.getName()); private Subscriber subscriber; @@ -102,13 +100,13 @@ public void init(BeanManager beanManager, Config config) { .thenRun(ackCtx::postAck) .exceptionally(t -> { ackCtx.postNack(t); - LOGGER.log(Level.SEVERE, t, - () -> "Error when invoking @Incoming method " + getMethod().getName()); + LOGGER.log(System.Logger.Level.ERROR, + () -> "Error when invoking @Incoming method " + getMethod().getName(), t); return null; }); }) - .onError(t -> LOGGER.log(Level.SEVERE, t, - () -> "Error intercepted on channel " + getIncomingChannelName())) + .onError(t -> LOGGER.log(System.Logger.Level.ERROR, + () -> "Error intercepted on channel " + getIncomingChannelName(), t)) .ignore() .build(); break; @@ -123,21 +121,21 @@ public void init(BeanManager beanManager, Config config) { return ReactiveStreams.fromCompletionStageNullable(result // on error resume .exceptionally(t -> { - LOGGER.log(Level.SEVERE, t, - () -> "Error when invoking @Incoming method " + getMethod().getName()); + LOGGER.log(System.Logger.Level.ERROR, + () -> "Error when invoking @Incoming method " + getMethod().getName(), t); ackCtx.postNack(t); return null; }) .thenRun(ackCtx::postAck)); } catch (Throwable t) { - LOGGER.log(Level.SEVERE, t, - () -> "Error when invoking @Incoming method " + getMethod().getName()); + LOGGER.log(System.Logger.Level.ERROR, + () -> "Error when invoking @Incoming method " + getMethod().getName(), t); ackCtx.postNack(t); return ReactiveStreams.empty(); } }) - .onError(t -> LOGGER.log(Level.SEVERE, t, - () -> "Error intercepted in channel " + getIncomingChannelName())) + .onError(t -> LOGGER.log(System.Logger.Level.ERROR, + () -> "Error intercepted in channel " + getIncomingChannelName(), t)) .ignore() .build(); break; @@ -157,14 +155,14 @@ public void init(BeanManager beanManager, Config config) { }) .thenRun(ackCtx::postAck)); } catch (Throwable t) { - LOGGER.log(Level.SEVERE, t, - () -> "Error when invoking @Incoming method " + getMethod().getName()); + LOGGER.log(System.Logger.Level.ERROR, + () -> "Error when invoking @Incoming method " + getMethod().getName(), t); ackCtx.postNack(t); return ReactiveStreams.empty(); } }) - .onError(t -> LOGGER.log(Level.SEVERE, t, - () -> "Error intercepted in channel " + getIncomingChannelName())) + .onError(t -> LOGGER.log(System.Logger.Level.ERROR, + () -> "Error intercepted in channel " + getIncomingChannelName(), t)) .ignore() .build(); break; diff --git a/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/LatestEmitter.java b/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/LatestEmitter.java index ce37bea46e8..c78984a22fb 100644 --- a/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/LatestEmitter.java +++ b/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/LatestEmitter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; import java.util.concurrent.ConcurrentLinkedDeque; -import java.util.logging.Level; -import java.util.logging.Logger; import io.helidon.common.reactive.BufferedEmittingPublisher; @@ -33,7 +31,7 @@ */ class LatestEmitter extends OutgoingEmitter { - private static final Logger LOGGER = Logger.getLogger(LatestEmitter.class.getName()); + private static final System.Logger LOGGER = System.getLogger(LatestEmitter.class.getName()); private final ConcurrentLinkedDeque buffer = new ConcurrentLinkedDeque<>(); private final BufferedEmittingPublisher bep = BufferedEmittingPublisher.builder() @@ -121,8 +119,8 @@ public void validate(Object payload) { long bufferLimit = getBufferLimit(); if (bufferLimit > 0 && bufferSize >= bufferLimit) { Object dropped = dropFirst(); - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, "Dropped first item: " + MessageUtils.unwrap(dropped)); + if (LOGGER.isLoggable(System.Logger.Level.TRACE)) { + LOGGER.log(System.Logger.Level.TRACE, "Dropped first item: " + MessageUtils.unwrap(dropped)); } } } diff --git a/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/ProcessorMethod.java b/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/ProcessorMethod.java index 2303fdc955b..a43e96e663a 100644 --- a/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/ProcessorMethod.java +++ b/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/ProcessorMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,6 @@ import java.lang.reflect.Method; import java.util.concurrent.CompletableFuture; import java.util.function.Function; -import java.util.logging.Level; -import java.util.logging.Logger; import io.helidon.common.Errors; import io.helidon.common.LazyValue; @@ -42,7 +40,7 @@ class ProcessorMethod extends AbstractMessagingMethod implements OutgoingMember, IncomingMember { - private static final Logger LOGGER = Logger.getLogger(ProcessorMethod.class.getName()); + private static final System.Logger LOGGER = System.getLogger(ProcessorMethod.class.getName()); private final LazyValue compatibilityMode = LazyValue.create(() -> ConfigProvider.getConfig().getOptionalValue("mp.messaging.helidon.propagate-errors", Boolean.class) @@ -137,7 +135,7 @@ private PublisherBuilder resumeOnError(Throwable t) { if (compatibilityMode.get()) { return ReactiveStreams.failed(t); } - LOGGER.log(Level.SEVERE, "Error intercepted in processor method " + LOGGER.log(System.Logger.Level.ERROR, "Error intercepted in processor method " + this.getMethod().getDeclaringClass().getSimpleName() + "#" + this.getMethod().getName() + " incoming channel: " + this.getIncomingChannelName() + " outgoing channel: " + this.getOutgoingChannelName(), t); diff --git a/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/ProxySubscriber.java b/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/ProxySubscriber.java index 7e07ced0f67..7547a494fcd 100644 --- a/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/ProxySubscriber.java +++ b/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/ProxySubscriber.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,6 @@ package io.helidon.microprofile.messaging; -import java.util.logging.Level; -import java.util.logging.Logger; - import org.eclipse.microprofile.reactive.messaging.Message; import org.reactivestreams.Subscriber; import org.reactivestreams.Subscription; @@ -30,7 +27,7 @@ */ class ProxySubscriber implements Subscriber { - private static final Logger LOGGER = Logger.getLogger(ProxySubscriber.class.getName()); + private static final System.Logger LOGGER = System.getLogger(ProxySubscriber.class.getName()); private final IncomingMethod method; private final Subscriber originalSubscriber; @@ -69,7 +66,7 @@ public void onNext(Object item) { ackCtx.postAck(); } catch (Throwable t) { ackCtx.postNack(t); - LOGGER.log(Level.SEVERE, "Error thrown by subscriber on channel " + method.getIncomingChannelName(), t); + LOGGER.log(System.Logger.Level.ERROR, "Error thrown by subscriber on channel " + method.getIncomingChannelName(), t); } } diff --git a/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/UniversalChannel.java b/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/UniversalChannel.java index e34020966c0..0ae2a5ff823 100644 --- a/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/UniversalChannel.java +++ b/microprofile/messaging/core/src/main/java/io/helidon/microprofile/messaging/UniversalChannel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package io.helidon.microprofile.messaging; import java.util.Optional; -import java.util.logging.Logger; import io.helidon.config.Config; import io.helidon.config.ConfigValue; @@ -29,7 +28,7 @@ class UniversalChannel { - private static final Logger LOGGER = Logger.getLogger(UniversalChannel.class.getName()); + private static final System.Logger LOGGER = System.getLogger(UniversalChannel.class.getName()); private String name; private IncomingMember incomingMember; @@ -124,7 +123,7 @@ void connect() { .append(name).append(" with outgoing method "); if (outgoingMember == null) { - LOGGER.severe(connectMessage.append("and no outgoing method found!").toString()); + LOGGER.log(System.Logger.Level.ERROR, connectMessage.append("and no outgoing method found!").toString()); throw ExceptionUtils.createNoOutgoingMethodForChannel(name); } @@ -140,7 +139,7 @@ void connect() { var optUpstreamChannel = Optional.ofNullable(this.upstreamChannel); if (incomingMember == null) { - LOGGER.severe(connectMessage.append("and no incoming method found!").toString()); + LOGGER.log(System.Logger.Level.ERROR, connectMessage.append("and no incoming method found!").toString()); throw ExceptionUtils.createNoIncomingMethodForChannel(name); } diff --git a/microprofile/messaging/core/src/main/java/module-info.java b/microprofile/messaging/core/src/main/java/module-info.java index 3b25d7a904e..22b2d37d41f 100644 --- a/microprofile/messaging/core/src/main/java/module-info.java +++ b/microprofile/messaging/core/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * Copyright (c) 2018, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ requires io.helidon.microprofile.reactive; requires io.helidon.microprofile.server; requires jakarta.inject; - requires java.logging; + requires microprofile.reactive.messaging.api; requires microprofile.reactive.streams.operators.api; diff --git a/microprofile/messaging/health/src/main/java/module-info.java b/microprofile/messaging/health/src/main/java/module-info.java index 080d3370d11..364db31a3e9 100644 --- a/microprofile/messaging/health/src/main/java/module-info.java +++ b/microprofile/messaging/health/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ module io.helidon.microprofile.messaging.health { requires jakarta.inject; - requires java.logging; + requires microprofile.health.api; requires transitive io.helidon.microprofile.health; diff --git a/microprofile/messaging/metrics/src/main/java/module-info.java b/microprofile/messaging/metrics/src/main/java/module-info.java index c61b58ae1de..3c1fb0155eb 100644 --- a/microprofile/messaging/metrics/src/main/java/module-info.java +++ b/microprofile/messaging/metrics/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * Copyright (c) 2022, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ requires jakarta.cdi; requires jakarta.inject; - requires java.logging; + requires transitive io.helidon.microprofile.messaging; requires transitive io.helidon.microprofile.metrics; diff --git a/microprofile/oidc/src/main/java/module-info.java b/microprofile/oidc/src/main/java/module-info.java index 966d1e4c99e..e0dcbd2c557 100644 --- a/microprofile/oidc/src/main/java/module-info.java +++ b/microprofile/oidc/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * Copyright (c) 2018, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ requires io.helidon.microprofile.security; requires io.helidon.microprofile.server; requires io.helidon.security.providers.oidc; - requires java.logging; + requires transitive jakarta.cdi; diff --git a/microprofile/reactive-streams/src/main/java/module-info.java b/microprofile/reactive-streams/src/main/java/module-info.java index 2fc734cb3ba..546ec410cc3 100644 --- a/microprofile/reactive-streams/src/main/java/module-info.java +++ b/microprofile/reactive-streams/src/main/java/module-info.java @@ -31,7 +31,7 @@ module io.helidon.microprofile.reactive { requires io.helidon.common.reactive; - requires java.logging; + requires static io.helidon.common.features.api; diff --git a/microprofile/telemetry/src/main/java/module-info.java b/microprofile/telemetry/src/main/java/module-info.java index efee39f33d6..f0dc09f8277 100644 --- a/microprofile/telemetry/src/main/java/module-info.java +++ b/microprofile/telemetry/src/main/java/module-info.java @@ -45,7 +45,7 @@ requires io.opentelemetry.sdk; requires jakarta.annotation; requires jakarta.inject; - requires java.logging; + requires microprofile.config.api; requires opentelemetry.instrumentation.annotations; diff --git a/security/integration/common/src/main/java/module-info.java b/security/integration/common/src/main/java/module-info.java index be04bdfe1e3..a701aea95b2 100644 --- a/security/integration/common/src/main/java/module-info.java +++ b/security/integration/common/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * Copyright (c) 2017, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ module io.helidon.security.integration.common { requires io.helidon.common.context; - requires java.logging; + requires transitive io.helidon.security; requires transitive io.helidon.tracing.config; diff --git a/security/security/src/main/java/io/helidon/security/DefaultAuditProvider.java b/security/security/src/main/java/io/helidon/security/DefaultAuditProvider.java index d77176fc776..7bb19dc4f7a 100644 --- a/security/security/src/main/java/io/helidon/security/DefaultAuditProvider.java +++ b/security/security/src/main/java/io/helidon/security/DefaultAuditProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * Copyright (c) 2018, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,6 @@ import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; -import java.util.logging.Level; -import java.util.logging.Logger; import io.helidon.common.config.Config; import io.helidon.security.spi.AuditProvider; @@ -29,32 +27,32 @@ * Default implementation of audit provider. */ final class DefaultAuditProvider implements AuditProvider { - private final Logger auditLogger; - private final Level failureLevel; - private final Level successLevel; - private final Level infoLevel; - private final Level warnLevel; - private final Level errorLevel; - private final Level auditFailureLevel; + private final System.Logger auditLogger; + private final System.Logger.Level failureLevel; + private final System.Logger.Level successLevel; + private final System.Logger.Level infoLevel; + private final System.Logger.Level warnLevel; + private final System.Logger.Level errorLevel; + private final System.Logger.Level auditFailureLevel; private DefaultAuditProvider(Config config) { // config node is already located on the security node - this.auditLogger = Logger.getLogger(config.get("audit.defaultProvider.logger") + this.auditLogger = System.getLogger(config.get("audit.defaultProvider.logger") .asString() .orElse("AUDIT")); - this.failureLevel = level(config, "failure", Level.FINEST); - this.successLevel = level(config, "success", Level.FINEST); - this.infoLevel = level(config, "info", Level.FINEST); - this.warnLevel = level(config, "warn", Level.WARNING); - this.errorLevel = level(config, "error", Level.SEVERE); - this.auditFailureLevel = level(config, "audit-failure", Level.SEVERE); + this.failureLevel = level(config, "failure", System.Logger.Level.TRACE); + this.successLevel = level(config, "success", System.Logger.Level.TRACE); + this.infoLevel = level(config, "info", System.Logger.Level.TRACE); + this.warnLevel = level(config, "warn", System.Logger.Level.WARNING); + this.errorLevel = level(config, "error", System.Logger.Level.ERROR); + this.auditFailureLevel = level(config, "audit-failure", System.Logger.Level.ERROR); } - private Level level(Config config, String auditSeverity, Level defaultLevel) { + private System.Logger.Level level(Config config, String auditSeverity, System.Logger.Level defaultLevel) { return config.get("audit.defaultProvider.level." + auditSeverity) .asString() - .map(Level::parse) + .map(s -> System.Logger.Level.valueOf(s)) .orElse(defaultLevel); } @@ -68,7 +66,7 @@ public Consumer auditConsumer() { } private void audit(TracedAuditEvent event) { - Level level; + System.Logger.Level level; switch (event.severity()) { case FAILURE: @@ -96,7 +94,7 @@ private void audit(TracedAuditEvent event) { logEvent(event, level); } - private void logEvent(TracedAuditEvent event, Level level) { + private void logEvent(TracedAuditEvent event, System.Logger.Level level) { if (!auditLogger.isLoggable(level)) { // no need to create the message when the message would not be logged return; diff --git a/security/security/src/main/java/io/helidon/security/ProviderRequest.java b/security/security/src/main/java/io/helidon/security/ProviderRequest.java index 7884e41fade..932b26d4f45 100644 --- a/security/security/src/main/java/io/helidon/security/ProviderRequest.java +++ b/security/security/src/main/java/io/helidon/security/ProviderRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021 Oracle and/or its affiliates. + * Copyright (c) 2018, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,6 @@ import java.util.Map; import java.util.Optional; import java.util.function.Supplier; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.stream.Collectors; import io.helidon.security.util.AbacSupport; @@ -44,7 +42,7 @@ * */ public class ProviderRequest implements AbacSupport { - private static final Logger LOGGER = Logger.getLogger(ProviderRequest.class.getName()); + private static final System.Logger LOGGER = System.getLogger(ProviderRequest.class.getName()); private final Map contextRoot = new HashMap<>(); private final Optional subject; @@ -109,10 +107,10 @@ public static Optional getValue(Object object, String key) { } } catch (NoSuchFieldException e) { // ignore, field is not present, we try accessor methods - LOGGER.log(Level.FINEST, e, () -> "Field \"" + key + "\" + is not present in class: " + aClass.getName()); + LOGGER.log(System.Logger.Level.TRACE, () -> "Field \"" + key + "\" + is not present in class: " + aClass.getName(), e); } catch (IllegalAccessException e) { // ignore, we check access first - LOGGER.log(Level.FINEST, e, () -> "Failed to access field: \"" + key + "\" in class: " + aClass.getName()); + LOGGER.log(System.Logger.Level.TRACE, () -> "Failed to access field: \"" + key + "\" in class: " + aClass.getName(), e); } //now check accessor methods @@ -150,7 +148,8 @@ static Optional getMethod(Class aClass, String methodName) { return Optional.empty(); } catch (NoSuchMethodException e) { // method is not present - LOGGER.log(Level.FINEST, e, () -> "Method: \"" + methodName + "\" is not in class: " + aClass.getName()); + LOGGER.log(System.Logger.Level.TRACE, + () -> "Method: \"" + methodName + "\" is not in class: " + aClass.getName(), e); return Optional.empty(); } } diff --git a/security/security/src/main/java/io/helidon/security/SecurityImpl.java b/security/security/src/main/java/io/helidon/security/SecurityImpl.java index dfd67c79761..11aa89e4ad2 100644 --- a/security/security/src/main/java/io/helidon/security/SecurityImpl.java +++ b/security/security/src/main/java/io/helidon/security/SecurityImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * Copyright (c) 2018, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,6 @@ import java.util.UUID; import java.util.function.Consumer; import java.util.function.Supplier; -import java.util.logging.Logger; import io.helidon.common.LazyValue; import io.helidon.common.config.Config; @@ -59,7 +58,7 @@ final class SecurityImpl implements Security { "environment" ); - private static final Logger LOGGER = Logger.getLogger(SecurityImpl.class.getName()); + private static final System.Logger LOGGER = System.getLogger(SecurityImpl.class.getName()); private final Collection> annotations = new LinkedList<>(); private final List> auditors = new LinkedList<>(); @@ -265,7 +264,8 @@ public Optional secret(String configurationName) { public String secret(String configurationName, String defaultValue) { Supplier> supplier = secrets.get(configurationName); if (supplier == null) { - LOGGER.finest(() -> "There is no configured secret named " + configurationName + ", using default value"); + LOGGER.log(System.Logger.Level.TRACE, + () -> "There is no configured secret named " + configurationName + ", using default value"); return defaultValue; } diff --git a/security/security/src/main/java/io/helidon/security/SecurityUtil.java b/security/security/src/main/java/io/helidon/security/SecurityUtil.java index 17aed56c583..b1933d3fadb 100644 --- a/security/security/src/main/java/io/helidon/security/SecurityUtil.java +++ b/security/security/src/main/java/io/helidon/security/SecurityUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * Copyright (c) 2018, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,6 @@ import java.util.Map; import java.util.Optional; import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.stream.Collectors; import io.helidon.common.config.Config; @@ -37,7 +35,7 @@ * Utility class for internal needs. */ final class SecurityUtil { - private static final Logger LOGGER = Logger.getLogger(SecurityUtil.class.getName()); + private static final System.Logger LOGGER = System.getLogger(SecurityUtil.class.getName()); private SecurityUtil() { } @@ -127,10 +125,9 @@ static T instantiate(String className, Class type, Config confi } catch (ClassCastException e) { throw new SecurityException("Class " + className + " is not instance of expected type: " + type.getName()); } catch (ConfigException e) { - LOGGER.log(Level.FINEST, - e, + LOGGER.log(System.Logger.Level.TRACE, () -> "Class " + className + " failed to get mapped by config. Will attempt public default " - + "constructor"); + + "constructor", e); configException = e; } } @@ -139,7 +136,7 @@ static T instantiate(String className, Class type, Config confi try { return type.cast(clazz.getConstructor().newInstance()); } catch (Exception e) { - LOGGER.log(Level.SEVERE, "Could not instantiate: " + className + ". Class must either have a default public" + LOGGER.log(System.Logger.Level.TRACE, "Could not instantiate: " + className + ". Class must either have a default public" + " constructor or be mappable by Config"); configException = ((null == configException) ? e : configException); diff --git a/security/security/src/main/java/module-info.java b/security/security/src/main/java/module-info.java index 4eb5370e385..986f0b84c34 100644 --- a/security/security/src/main/java/module-info.java +++ b/security/security/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * Copyright (c) 2017, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ requires io.helidon.common.context; requires io.helidon.common.uri; - requires java.logging; + requires static io.helidon.common.features.api; requires static io.helidon.config.metadata; diff --git a/tests/apps/bookstore/bookstore-mp/src/main/java/module-info.java b/tests/apps/bookstore/bookstore-mp/src/main/java/module-info.java index 4117a3a8ba1..461cdb0b3e8 100644 --- a/tests/apps/bookstore/bookstore-mp/src/main/java/module-info.java +++ b/tests/apps/bookstore/bookstore-mp/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ requires io.helidon.tests.apps.bookstore.common; requires jakarta.json.bind; requires jakarta.json; - requires java.logging; + opens io.helidon.tests.apps.bookstore.mp to io.helidon.microprofile.cdi,weld.core.impl; diff --git a/tests/apps/bookstore/bookstore-se/src/main/java/module-info.java b/tests/apps/bookstore/bookstore-se/src/main/java/module-info.java index adeefd59b1d..1b11867c081 100644 --- a/tests/apps/bookstore/bookstore-se/src/main/java/module-info.java +++ b/tests/apps/bookstore/bookstore-se/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ requires io.helidon.webserver.observe.metrics; requires io.helidon.webserver; requires jakarta.json; - requires java.logging; + exports io.helidon.tests.apps.bookstore.se; diff --git a/tests/integration/native-image/mp-3/src/main/java/module-info.java b/tests/integration/native-image/mp-3/src/main/java/module-info.java index 5e01f0521b9..1ce80445a4d 100644 --- a/tests/integration/native-image/mp-3/src/main/java/module-info.java +++ b/tests/integration/native-image/mp-3/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023 Oracle and/or its affiliates. + * Copyright (c) 2020, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ */ module helidon.tests.nimage.quickstartmp { - requires java.logging; + requires io.helidon.microprofile.bundle; exports io.helidon.tests.integration.nativeimage.mp3; diff --git a/tracing/jersey-client/src/main/java/module-info.java b/tracing/jersey-client/src/main/java/module-info.java index 24742455ad4..e1741901ec4 100644 --- a/tracing/jersey-client/src/main/java/module-info.java +++ b/tracing/jersey-client/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * Copyright (c) 2017, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ requires io.helidon.tracing.config; requires io.helidon.tracing; requires jakarta.annotation; - requires java.logging; + requires jersey.common; requires static io.helidon.common.features.api; diff --git a/tracing/providers/zipkin/src/main/java/module-info.java b/tracing/providers/zipkin/src/main/java/module-info.java index dae560d611c..386d6fa0674 100644 --- a/tracing/providers/zipkin/src/main/java/module-info.java +++ b/tracing/providers/zipkin/src/main/java/module-info.java @@ -33,7 +33,7 @@ requires io.helidon.tracing.providers.opentracing; requires io.opentracing.noop; requires io.opentracing.util; - requires java.logging; + requires static io.helidon.common.features.api; requires static io.helidon.config.metadata; diff --git a/webserver/graphql/src/main/java/module-info.java b/webserver/graphql/src/main/java/module-info.java index 320d1bdff2a..db3bf8c0c79 100644 --- a/webserver/graphql/src/main/java/module-info.java +++ b/webserver/graphql/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * Copyright (c) 2022, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ requires io.helidon.graphql.server; requires io.helidon.webserver.cors; requires jakarta.json.bind; - requires java.logging; + requires org.eclipse.yasson; requires static io.helidon.common.features.api; diff --git a/webserver/grpc/src/main/java/module-info.java b/webserver/grpc/src/main/java/module-info.java index 152d3b7d38f..a223f78cc5b 100644 --- a/webserver/grpc/src/main/java/module-info.java +++ b/webserver/grpc/src/main/java/module-info.java @@ -34,7 +34,7 @@ requires io.grpc.protobuf.lite; requires io.helidon.builder.api; requires io.helidon.webserver.http2; - requires java.logging; + requires static io.helidon.common.features.api; diff --git a/webserver/observe/log/src/main/java/module-info.java b/webserver/observe/log/src/main/java/module-info.java index a9b48c16197..492e0a82a13 100644 --- a/webserver/observe/log/src/main/java/module-info.java +++ b/webserver/observe/log/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * Copyright (c) 2022, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,5 +41,5 @@ provides io.helidon.webserver.observe.spi.ObserveProvider with io.helidon.webserver.observe.log.LogObserveProvider; - + } \ No newline at end of file diff --git a/webserver/security/src/main/java/io/helidon/webserver/security/SecurityHandler.java b/webserver/security/src/main/java/io/helidon/webserver/security/SecurityHandler.java index d5a1057bc8d..7debb2d2800 100644 --- a/webserver/security/src/main/java/io/helidon/webserver/security/SecurityHandler.java +++ b/webserver/security/src/main/java/io/helidon/webserver/security/SecurityHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023 Oracle and/or its affiliates. + * Copyright (c) 2018, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,6 @@ import java.util.Set; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; -import java.util.logging.Level; -import java.util.logging.Logger; import io.helidon.builder.api.RuntimeType; import io.helidon.common.config.Config; @@ -74,7 +72,7 @@ public final class SecurityHandler implements Handler, RuntimeType.Api { static final String DEFAULT_AUDIT_EVENT_TYPE = "request"; static final String DEFAULT_AUDIT_MESSAGE_FORMAT = "%3$s %1$s \"%2$s\" %5$s %6$s requested by %4$s"; - private static final Logger LOGGER = Logger.getLogger(SecurityHandler.class.getName()); + private static final System.Logger LOGGER = System.getLogger(SecurityHandler.class.getName()); private static final SecurityHandler DEFAULT_INSTANCE = builder().build(); private final SecurityHandlerConfig config; @@ -499,7 +497,7 @@ private void processSecurity(SecurityContext securityContext, ServerRequest req, } } catch (Exception e) { tracing.error(e); - LOGGER.log(Level.SEVERE, "Unexpected exception during security processing", e); + LOGGER.log(System.Logger.Level.ERROR, "Unexpected exception during security processing", e); abortRequest(res, null, Status.INTERNAL_SERVER_ERROR_500.code(), Map.of()); } @@ -620,7 +618,7 @@ private void atnSpanFinish(AtnTracing atnTracing, AuthenticationResponse respons private boolean atnAbstainFailure(ServerResponse res, AuthenticationResponse response) { if (authenticationOptional.orElse(false)) { - LOGGER.finest("Authentication failed, but was optional, so assuming anonymous"); + LOGGER.log(System.Logger.Level.TRACE, "Authentication failed, but was optional, so assuming anonymous"); return false; } @@ -634,7 +632,7 @@ private boolean atnAbstainFailure(ServerResponse res, AuthenticationResponse res private boolean atnFinishFailure(ServerResponse res, AuthenticationResponse response) { if (authenticationOptional.orElse(false)) { - LOGGER.finest("Authentication failed, but was optional, so assuming anonymous"); + LOGGER.log(System.Logger.Level.TRACE, "Authentication failed, but was optional, so assuming anonymous"); return false; } else { int defaultStatusCode = Status.UNAUTHORIZED_401.code(); diff --git a/webserver/security/src/main/java/io/helidon/webserver/security/SecurityHttpFeature.java b/webserver/security/src/main/java/io/helidon/webserver/security/SecurityHttpFeature.java index 054702197b4..1b08bd0aaea 100644 --- a/webserver/security/src/main/java/io/helidon/webserver/security/SecurityHttpFeature.java +++ b/webserver/security/src/main/java/io/helidon/webserver/security/SecurityHttpFeature.java @@ -19,7 +19,6 @@ import java.util.List; import java.util.Objects; import java.util.Optional; -import java.util.logging.Logger; import io.helidon.common.Weighted; import io.helidon.common.config.Config; @@ -99,7 +98,7 @@ public final class SecurityHttpFeature implements HttpSecurity, HttpFeature, Wei */ public static final String CONTEXT_RESPONSE_HEADERS = "security.responseHeaders"; - private static final Logger LOGGER = Logger.getLogger(SecurityHttpFeature.class.getName()); + private static final System.Logger LOGGER = System.getLogger(SecurityHttpFeature.class.getName()); private final Security security; private final SecurityHandler defaultHandler; @@ -174,7 +173,7 @@ public SecurityHttpFeature securityDefaults(SecurityHandler defaultHandler) { @Override public void setup(HttpRouting.Builder rules) { if (!security.enabled()) { - LOGGER.info("Security is disabled. Not registering any security handlers"); + LOGGER.log(System.Logger.Level.INFO, "Security is disabled. Not registering any security handlers"); return; } rules.security(this); diff --git a/webserver/security/src/main/java/module-info.java b/webserver/security/src/main/java/module-info.java index b04ade996b6..fa4effd6e56 100644 --- a/webserver/security/src/main/java/module-info.java +++ b/webserver/security/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * Copyright (c) 2022, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ requires io.helidon.common.context; requires io.helidon.security.integration.common; requires io.helidon.webserver; - requires java.logging; + requires transitive io.helidon.builder.api; requires transitive io.helidon.common;