Skip to content

Do not disable Google HTTP Client logging for custom logger in Gradle#2357

Merged
chanseokoh merged 4 commits into
masterfrom
gradle-http-logs
Mar 26, 2020
Merged

Do not disable Google HTTP Client logging for custom logger in Gradle#2357
chanseokoh merged 4 commits into
masterfrom
gradle-http-logs

Conversation

@chanseokoh

Copy link
Copy Markdown
Member

Fixes #2356.

One of the ways to have a custom logger is through the system property java.util.logging.config.file. If it's defined, don't disable Google HTTP Client logging.

@chanseokoh

Copy link
Copy Markdown
Member Author

Travis seems to have completely stalled. Will try closing and reopening.

@chanseokoh chanseokoh closed this Mar 24, 2020
@chanseokoh chanseokoh reopened this Mar 24, 2020
// https://github.com/GoogleContainerTools/jib/issues/2356
if (System.getProperty("java.util.logging.config.file") == null) {
// Disables Google HTTP client logging.
java.util.logging.Logger.getLogger(HttpTransport.class.getName()).setLevel(Level.OFF);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand how this solves the problem? Does gradle have it's own custom logger? And if we disable this, does this show that weird log information that we turned this off for?

@chanseokoh chanseokoh Mar 26, 2020

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps my code comment is confusing.

To explain,

  • Google HTTP Client's HttpTransport class uses JUL.Logger.getLogger(HttpTransport.class.getName()) to log detailed network traffic.
  • HttpTransport class outputs detailed network traffic at INFO level.
  • In Gradle, increasing general verbosity to at least --info allows JUL to print INFO messages, as expected.
  • Therefore, running gradle --info generates a lot of network traffic output. This is unnecessary clutter, so we universally disabled the JUL logging of HttpTransport by calling setLevel(Level.OFF) when we start a task. We still want this.
  • Therefore, our FAQ instructions to capture detailed networks logs using JUL (via -Djava.util.logging.config.file) doesn't work.

Does this make it clear?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooooh I see, yeah sounds good.

@chanseokoh
chanseokoh merged commit 547ef15 into master Mar 26, 2020
@chanseokoh
chanseokoh deleted the gradle-http-logs branch March 26, 2020 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jib Gradle plugin disables Google HTTP Client logging

3 participants