|
16 | 16 |
|
17 | 17 | package com.google.cloud.tools.jib.gradle; |
18 | 18 |
|
19 | | -import com.google.api.client.http.HttpTransport; |
20 | 19 | import com.google.cloud.tools.jib.builder.BuildConfiguration; |
21 | 20 | import com.google.cloud.tools.jib.docker.DockerClient; |
22 | 21 | import com.google.cloud.tools.jib.frontend.BuildStepsExecutionException; |
|
29 | 28 | import com.google.cloud.tools.jib.registry.RegistryClient; |
30 | 29 | import com.google.cloud.tools.jib.registry.credentials.RegistryCredentials; |
31 | 30 | import com.google.common.base.Preconditions; |
32 | | -import java.util.logging.Level; |
33 | | -import java.util.logging.Logger; |
34 | 31 | import javax.annotation.Nullable; |
35 | 32 | import org.gradle.api.DefaultTask; |
36 | 33 | import org.gradle.api.GradleException; |
37 | 34 | import org.gradle.api.tasks.Nested; |
38 | 35 | import org.gradle.api.tasks.TaskAction; |
39 | 36 | import org.gradle.api.tasks.options.Option; |
40 | | -import org.gradle.internal.logging.events.LogEvent; |
41 | | -import org.gradle.internal.logging.events.OutputEventListener; |
42 | | -import org.gradle.internal.logging.slf4j.OutputEventListenerBackedLoggerContext; |
43 | | -import org.slf4j.LoggerFactory; |
44 | 37 |
|
45 | 38 | /** Builds a container image and exports to the default Docker daemon. */ |
46 | 39 | public class BuildDockerTask extends DefaultTask { |
@@ -98,23 +91,8 @@ public void buildDocker() throws InvalidImageReferenceException { |
98 | 91 | .setJvmFlags(jibExtension.getJvmFlags()) |
99 | 92 | .build(); |
100 | 93 |
|
101 | | - // TODO: Consolidate with BuildImageTask |
102 | 94 | // TODO: Instead of disabling logging, have authentication credentials be provided |
103 | | - // Disables annoying Apache HTTP client logging. |
104 | | - // Note that this is a hack and depends on internal Gradle classes |
105 | | - OutputEventListenerBackedLoggerContext context = |
106 | | - (OutputEventListenerBackedLoggerContext) LoggerFactory.getILoggerFactory(); |
107 | | - OutputEventListener defaultOutputEventListener = context.getOutputEventListener(); |
108 | | - context.setOutputEventListener( |
109 | | - event -> { |
110 | | - LogEvent logEvent = (LogEvent) event; |
111 | | - if (!logEvent.getCategory().contains("org.apache")) { |
112 | | - defaultOutputEventListener.onOutput(event); |
113 | | - } |
114 | | - }); |
115 | | - |
116 | | - // Disables Google HTTP client logging. |
117 | | - Logger.getLogger(HttpTransport.class.getName()).setLevel(Level.OFF); |
| 95 | + GradleProjectProperties.disableHttpLogging(); |
118 | 96 |
|
119 | 97 | RegistryClient.setUserAgentSuffix(USER_AGENT_SUFFIX); |
120 | 98 |
|
|
0 commit comments