Skip to content

Commit cf82198

Browse files
authored
4.x: Use System.Logger instead of JUL where applicable helidon-io#7792 (helidon-io#8791)
* 4.x: Use System.Logger instead of JUL where applicable helidon-io#7792 Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
1 parent 15fb498 commit cf82198

70 files changed

Lines changed: 200 additions & 262 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

common/common/src/main/java/module-info.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2024 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,9 +19,6 @@
1919
*/
2020
module io.helidon.common {
2121

22-
// used only by LogConfig
23-
requires java.logging;
24-
2522
exports io.helidon.common;
2623

2724
}

common/configurable/pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@
116116
</path>
117117
</annotationProcessorPaths>
118118
</configuration>
119+
<executions>
120+
<execution>
121+
<id>default-testCompile</id>
122+
<configuration>
123+
<!-- We use JUL from tests, need this for compilation -->
124+
<compilerArgs>
125+
<compilerArg>--add-modules</compilerArg>
126+
<compilerArg>java.logging</compilerArg>
127+
</compilerArgs>
128+
</configuration>
129+
</execution>
130+
</executions>
119131
<dependencies>
120132
<dependency>
121133
<groupId>io.helidon.config</groupId>

common/configurable/src/main/java/module-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2018, 2024 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

common/configurable/src/test/java/io/helidon/common/configurable/ThreadPoolTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2022 Oracle and/or its affiliates.
2+
* Copyright (c) 2019, 2024 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

config/etcd/src/main/java/io/helidon/config/etcd/EtcdConfigSource.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2022 Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2024 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,8 +22,6 @@
2222
import java.nio.charset.StandardCharsets;
2323
import java.util.List;
2424
import java.util.Optional;
25-
import java.util.logging.Level;
26-
import java.util.logging.Logger;
2725

2826
import io.helidon.common.media.type.MediaType;
2927
import io.helidon.common.media.type.MediaTypes;
@@ -51,7 +49,7 @@
5149
public class EtcdConfigSource extends AbstractConfigSource
5250
implements PollableSource<Long>, WatchableSource<EtcdEndpoint>, ParsableSource {
5351

54-
private static final Logger LOGGER = Logger.getLogger(EtcdConfigSource.class.getName());
52+
private static final System.Logger LOGGER = System.getLogger(EtcdConfigSource.class.getName());
5553

5654
private final EtcdEndpoint endpoint;
5755
private final List<EtcdEndpoint> endpoints;
@@ -119,7 +117,7 @@ public Optional<Content> load() throws ConfigException {
119117
try {
120118
content = etcdClient().get(endpoint.key());
121119
} catch (EtcdClientException e) {
122-
LOGGER.log(Level.FINEST, "Get operation threw an exception.", e);
120+
LOGGER.log(System.Logger.Level.TRACE, "Get operation threw an exception.", e);
123121
throw new ConfigException(String.format("Could not get data for key '%s'", endpoint.key()), e);
124122
}
125123

config/etcd/src/main/java/io/helidon/config/etcd/EtcdWatcher.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2020 Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2024 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,8 +19,6 @@
1919
import java.util.concurrent.Flow;
2020
import java.util.concurrent.atomic.AtomicBoolean;
2121
import java.util.function.Consumer;
22-
import java.util.logging.Level;
23-
import java.util.logging.Logger;
2422

2523
import io.helidon.config.Config;
2624
import io.helidon.config.etcd.EtcdConfigSourceBuilder.EtcdEndpoint;
@@ -34,7 +32,7 @@
3432
*/
3533
public class EtcdWatcher implements ChangeWatcher<EtcdEndpoint> {
3634

37-
private static final Logger LOGGER = Logger.getLogger(EtcdWatcher.class.getName());
35+
private static final System.Logger LOGGER = System.getLogger(EtcdWatcher.class.getName());
3836

3937
private final AtomicBoolean started = new AtomicBoolean();
4038

@@ -80,7 +78,7 @@ public void start(EtcdEndpoint endpoint, Consumer<ChangeEvent<EtcdEndpoint>> lis
8078
Flow.Publisher<Long> watchPublisher = etcdClient().watch(endpoint.key());
8179
watchPublisher.subscribe(new EtcdWatchSubscriber(listener, endpoint));
8280
} catch (EtcdClientException ex) {
83-
LOGGER.log(Level.WARNING, String.format("Subscription on watching on '%s' key has failed. "
81+
LOGGER.log(System.Logger.Level.WARNING, String.format("Subscription on watching on '%s' key has failed. "
8482
+ "Watching by '%s' polling strategy will not start.",
8583
EtcdWatcher.this.endpoint.key(),
8684
EtcdWatcher.this), ex);
@@ -96,7 +94,7 @@ public void stop() {
9694
try {
9795
this.etcdClient.close();
9896
} catch (EtcdClientException e) {
99-
LOGGER.log(Level.FINE, "Faield to close etcd client", e);
97+
LOGGER.log(System.Logger.Level.TRACE, "Faield to close etcd client", e);
10098
}
10199
}
102100

@@ -142,7 +140,7 @@ public void onNext(Long item) {
142140

143141
@Override
144142
public void onError(Throwable throwable) {
145-
LOGGER.log(Level.WARNING,
143+
LOGGER.log(System.Logger.Level.WARNING,
146144
String.format(
147145
"Watching on '%s' key has failed. Watching will not continue. ",
148146
endpoint.key()),

config/etcd/src/main/java/io/helidon/config/etcd/internal/client/v2/EtcdV2Client.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2024 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,8 +25,6 @@
2525
import java.util.concurrent.SubmissionPublisher;
2626
import java.util.concurrent.TimeUnit;
2727
import java.util.concurrent.TimeoutException;
28-
import java.util.logging.Level;
29-
import java.util.logging.Logger;
3028

3129
import io.helidon.config.etcd.internal.client.EtcdClient;
3230
import io.helidon.config.etcd.internal.client.EtcdClientException;
@@ -45,7 +43,7 @@
4543

4644
public class EtcdV2Client implements EtcdClient {
4745

48-
private static final Logger LOGGER = Logger.getLogger(EtcdV2Client.class.getName());
46+
private static final System.Logger LOGGER = System.getLogger(EtcdV2Client.class.getName());
4947

5048
private final Map<String, SubmissionPublisher<Long>> publishers = new ConcurrentHashMap<>();
5149
private final mousio.etcd4j.EtcdClient etcd;
@@ -150,7 +148,7 @@ public void onResponse(ResponsePromise<EtcdKeysResponse> responsePromise) {
150148
publisher.submit(modifiedIndex);
151149
waitForChange(modifiedIndex + 1);
152150
} catch (Exception e) {
153-
LOGGER.log(Level.CONFIG, "Cannot read changed value.", e);
151+
LOGGER.log(System.Logger.Level.INFO, "Cannot read changed value.", e);
154152
}
155153

156154
}

config/etcd/src/main/java/io/helidon/config/etcd/internal/client/v3/EtcdV3Client.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2021 Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2024 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,8 +23,6 @@
2323
import java.util.concurrent.Flow;
2424
import java.util.concurrent.SubmissionPublisher;
2525
import java.util.concurrent.TimeUnit;
26-
import java.util.logging.Level;
27-
import java.util.logging.Logger;
2826

2927
import io.helidon.config.etcd.internal.client.EtcdClient;
3028
import io.helidon.config.etcd.internal.client.EtcdClientException;
@@ -48,7 +46,7 @@
4846
*/
4947
public class EtcdV3Client implements EtcdClient {
5048

51-
private static final Logger LOGGER = Logger.getLogger(EtcdV3Client.class.getName());
49+
private static final System.Logger LOGGER = System.getLogger(EtcdV3Client.class.getName());
5250

5351
private final Map<String, SubmissionPublisher<Long>> publishers = new ConcurrentHashMap<>();
5452

@@ -148,7 +146,7 @@ public void close() throws EtcdClientException {
148146
try {
149147
channel.awaitTermination(1, TimeUnit.SECONDS);
150148
} catch (InterruptedException e) {
151-
LOGGER.log(Level.CONFIG, "Error closing gRPC channel, reason: " + e.getLocalizedMessage(), e);
149+
LOGGER.log(System.Logger.Level.INFO, "Error closing gRPC channel, reason: " + e.getLocalizedMessage(), e);
152150
} finally {
153151
channel.shutdown();
154152
}

config/etcd/src/main/java/module-info.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2024 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,6 @@
2929
requires io.grpc.stub;
3030
requires io.helidon.common.media.type;
3131
requires io.helidon.common;
32-
requires java.logging;
3332

3433
requires static java.annotation;
3534

config/hocon/src/main/java/module-info.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2024 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,6 @@
2929
module io.helidon.config.hocon {
3030

3131
requires io.helidon.common;
32-
requires java.logging;
3332
requires typesafe.config;
3433

3534
requires static io.helidon.common.features.api;

0 commit comments

Comments
 (0)