This is an automated email from the ASF dual-hosted git repository.
mattcasters pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new e0ab7fe97d Fixes #8340: Suppress excessive HTTP wire logging by
defaulting to INFO at startup (#8343)
e0ab7fe97d is described below
commit e0ab7fe97dc9b398d3e6d616a7918e83e0723c4f
Author: Abhirama <[email protected]>
AuthorDate: Sun Sep 13 21:32:46 2026 +0530
Fixes #8340: Suppress excessive HTTP wire logging by defaulting to INFO at
startup (#8343)
---
.../java/org/apache/hop/core/HopEnvironment.java | 43 ++++++++++++
.../hop/core/HopEnvironmentSystemPropertyTest.java | 82 ++++++++++++++++++++++
2 files changed, 125 insertions(+)
diff --git a/engine/src/main/java/org/apache/hop/core/HopEnvironment.java
b/engine/src/main/java/org/apache/hop/core/HopEnvironment.java
index dbe3cf1969..81af7d196a 100644
--- a/engine/src/main/java/org/apache/hop/core/HopEnvironment.java
+++ b/engine/src/main/java/org/apache/hop/core/HopEnvironment.java
@@ -131,6 +131,8 @@ public class HopEnvironment {
System.setProperties(ConcurrentMapProperties.convertProperties(System.getProperties()));
try {
+ silenceVerboseThirdPartyLoggers();
+
// This creates .hop and hop.properties...
//
if (!HopClientEnvironment.isInitialized()) {
@@ -269,4 +271,45 @@ public class HopEnvironment {
HopClientEnvironment.reset();
initialized.set(null);
}
+
+ /**
+ * Strong reference to prevent java.util.logging.LogManager from
garbage-collecting the logger.
+ */
+ @SuppressWarnings("java:S3985")
+ private static final java.util.logging.Logger JUL_WIRE_LOGGER =
+ java.util.logging.Logger.getLogger("org.apache.hc.client5.http.wire");
+
+ /**
+ * Default verbose third-party loggers to a non-debug level to prevent
dumping raw network bytes
+ * to the console while preserving explicitly configured debug settings.
+ */
+ private static void silenceVerboseThirdPartyLoggers() {
+ String wireLoggerName = "org.apache.hc.client5.http.wire";
+
+ // Silence JUL logger to prevent verbose byte dumps on backends printing
via java.util.logging
+ try {
+ if (JUL_WIRE_LOGGER.getLevel() == null) {
+ JUL_WIRE_LOGGER.setLevel(java.util.logging.Level.WARNING);
+ }
+ } catch (Exception ignored) {
+ // Ignore if JUL cannot be configured
+ }
+
+ // Configure Log4j2 if present on the classpath, preserving any explicit
configuration
+ try {
+ org.apache.logging.log4j.core.LoggerContext context =
+ org.apache.logging.log4j.core.LoggerContext.getContext(false);
+ org.apache.logging.log4j.core.config.Configuration configuration =
context.getConfiguration();
+ org.apache.logging.log4j.core.config.LoggerConfig loggerConfig =
+ configuration.getLoggerConfig(wireLoggerName);
+ boolean isExplicitlyConfigured =
+ wireLoggerName.equals(loggerConfig.getName()) &&
loggerConfig.getExplicitLevel() != null;
+ if (!isExplicitlyConfigured) {
+ org.apache.logging.log4j.core.config.Configurator.setLevel(
+ wireLoggerName, org.apache.logging.log4j.Level.INFO);
+ }
+ } catch (LinkageError | Exception ignored) {
+ // Ignore if Log4j2 core is not available or configuration fails
+ }
+ }
}
diff --git
a/engine/src/test/java/org/apache/hop/core/HopEnvironmentSystemPropertyTest.java
b/engine/src/test/java/org/apache/hop/core/HopEnvironmentSystemPropertyTest.java
index 85ce18b6bd..106dd7c35e 100644
---
a/engine/src/test/java/org/apache/hop/core/HopEnvironmentSystemPropertyTest.java
+++
b/engine/src/test/java/org/apache/hop/core/HopEnvironmentSystemPropertyTest.java
@@ -18,6 +18,8 @@
package org.apache.hop.core;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.hop.core.config.HopConfig;
import org.apache.hop.core.variables.DescribedVariable;
@@ -94,4 +96,84 @@ class HopEnvironmentSystemPropertyTest {
actualValue,
"Config file property should be applied when not set via
command-line");
}
+
+ @Test
+ void testThirdPartyWireLoggingSilencedByDefault() throws Exception {
+ org.apache.logging.log4j.core.LoggerContext context =
+ org.apache.logging.log4j.core.LoggerContext.getContext(false);
+ org.apache.logging.log4j.core.config.Configuration configuration =
context.getConfiguration();
+ String wireLogger = "org.apache.hc.client5.http.wire";
+ java.util.logging.Logger julLogger =
java.util.logging.Logger.getLogger(wireLogger);
+ java.util.logging.Level originalJulLevel = julLogger.getLevel();
+
+ try {
+ configuration.removeLogger(wireLogger);
+ context.updateLoggers();
+ julLogger.setLevel(null);
+
+ HopEnvironment.init();
+
+ org.apache.logging.log4j.core.config.LoggerConfig lc =
+ configuration.getLoggerConfig(wireLogger);
+ assertEquals(
+ wireLogger,
+ lc.getName(),
+ "HttpClient 5 wire logger configuration should be explicitly
registered");
+ assertEquals(
+ org.apache.logging.log4j.Level.INFO,
+ lc.getLevel(),
+ "HttpClient 5 wire logger should default to INFO to suppress verbose
dumps");
+ assertFalse(
+
org.apache.logging.log4j.LogManager.getLogger(wireLogger).isDebugEnabled(),
+ "HttpClient 5 wire logger should not have debug enabled by default");
+ assertEquals(
+ java.util.logging.Level.WARNING,
+ julLogger.getLevel(),
+ "JUL wire logger should default to WARNING to suppress console byte
dumps");
+ } finally {
+ configuration.removeLogger(wireLogger);
+ context.updateLoggers();
+ julLogger.setLevel(originalJulLevel);
+ }
+ }
+
+ @Test
+ void testThirdPartyWireLoggingPreservesExplicitDebug() throws Exception {
+ org.apache.logging.log4j.core.LoggerContext context =
+ org.apache.logging.log4j.core.LoggerContext.getContext(false);
+ org.apache.logging.log4j.core.config.Configuration configuration =
context.getConfiguration();
+ String wireLogger = "org.apache.hc.client5.http.wire";
+ java.util.logging.Logger julLogger =
java.util.logging.Logger.getLogger(wireLogger);
+ java.util.logging.Level originalJulLevel = julLogger.getLevel();
+
+ try {
+ org.apache.logging.log4j.core.config.Configurator.setLevel(
+ wireLogger, org.apache.logging.log4j.Level.DEBUG);
+ julLogger.setLevel(java.util.logging.Level.FINE);
+
+ HopEnvironment.init();
+
+ org.apache.logging.log4j.core.config.LoggerConfig lc =
+ configuration.getLoggerConfig(wireLogger);
+ assertEquals(
+ wireLogger,
+ lc.getName(),
+ "HttpClient 5 wire logger configuration should match the target
logger");
+ assertEquals(
+ org.apache.logging.log4j.Level.DEBUG,
+ lc.getLevel(),
+ "Explicitly configured DEBUG level should not be overridden by
HopEnvironment.init()");
+ assertTrue(
+
org.apache.logging.log4j.LogManager.getLogger(wireLogger).isDebugEnabled(),
+ "HttpClient 5 wire logger should preserve explicit debug enabled
state");
+ assertEquals(
+ java.util.logging.Level.FINE,
+ julLogger.getLevel(),
+ "Explicitly configured JUL FINE level should not be overridden by
HopEnvironment.init()");
+ } finally {
+ configuration.removeLogger(wireLogger);
+ context.updateLoggers();
+ julLogger.setLevel(originalJulLevel);
+ }
+ }
}