-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Suppress log spams in gcsio 3.0 #38588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,7 @@ | |
| import java.util.concurrent.LinkedBlockingQueue; | ||
| import java.util.concurrent.ThreadPoolExecutor; | ||
| import java.util.concurrent.TimeUnit; | ||
| import java.util.concurrent.atomic.AtomicBoolean; | ||
| import java.util.concurrent.atomic.AtomicInteger; | ||
| import java.util.function.Consumer; | ||
| import java.util.function.Supplier; | ||
|
|
@@ -184,6 +185,7 @@ public boolean shouldRetry(IOException e) { | |
| return RetryDeterminer.SOCKET_ERRORS.shouldRetry(e); | ||
| } | ||
| }; | ||
| private static final AtomicBoolean overwriteLog = new AtomicBoolean(false); | ||
|
|
||
| ///////////////////////////////////////////////////////////////////////////// | ||
|
|
||
|
|
@@ -726,9 +728,16 @@ public WritableByteChannel create(GcsPath path, CreateOptions options) throws IO | |
| } | ||
| } | ||
|
|
||
| @SuppressFBWarnings("LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE") | ||
| GoogleCloudStorage createGoogleCloudStorage( | ||
| GoogleCloudStorageOptions options, Storage storage, Credentials credentials) | ||
| throws IOException { | ||
| // Suppress log spams in gcsio 3.0 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tested working with |
||
| if (overwriteLog.compareAndSet(false, true)) { | ||
| java.util.logging.Logger.getLogger("com.google.cloud.hadoop.gcsio.GoogleCloudStorageImpl") | ||
| .setLevel(java.util.logging.Level.SEVERE); | ||
| } | ||
|
Comment on lines
+736
to
+739
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using if (gcsioLoggerConfigured.compareAndSet(false, true)) {
java.util.logging.Logger gcsLogger =
java.util.logging.Logger.getLogger(GoogleCloudStorageImpl.class.getName());
gcsLogger.setLevel(java.util.logging.Level.SEVERE);
}
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The spamming log is a WARN log, see PR description |
||
|
|
||
| return GoogleCloudStorageImpl.builder() | ||
| .setOptions(options) | ||
| .setHttpTransport(storage.getRequestFactory().getTransport()) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name
overwriteLogis somewhat ambiguous and could be interpreted as overwriting a log file. Renaming it to something likegcsioLoggerConfiguredwould more clearly indicate that it tracks whether the logging configuration for the GCS IO library has been applied.