From c1106697382d1896d9e5386b4356efd5581f9b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harri=20Sm=C3=A5tt?= Date: Wed, 16 Oct 2024 11:48:16 +0300 Subject: [PATCH] Revert "[#3656] Add Message Tracing logs" This reverts commit b94163d580122b4863d344521e243ae2f3c9af34. --- .../coap/AbstractVertxBasedCoapAdapter.java | 7 ----- .../hono/adapter/coap/CoapAdapterOptions.java | 10 ------- .../adapter/coap/CoapAdapterProperties.java | 30 ------------------- .../admin-guide/coap-adapter-config.md | 1 - 4 files changed, 48 deletions(-) diff --git a/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/AbstractVertxBasedCoapAdapter.java b/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/AbstractVertxBasedCoapAdapter.java index 477e94f36f..f56859b603 100644 --- a/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/AbstractVertxBasedCoapAdapter.java +++ b/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/AbstractVertxBasedCoapAdapter.java @@ -20,7 +20,6 @@ import org.eclipse.californium.core.CoapServer; import org.eclipse.californium.core.coap.CoAP; import org.eclipse.californium.core.network.Endpoint; -import org.eclipse.californium.core.network.interceptors.MessageTracer; import org.eclipse.californium.core.server.resources.Resource; import org.eclipse.hono.adapter.AbstractProtocolAdapterBase; import org.eclipse.hono.util.Constants; @@ -199,9 +198,6 @@ protected Resource createRoot() { final Future secureEndpointFuture = endpointFactory.getSecureEndpoint() .onFailure(t -> log.info("not creating secure endpoint: {}", t.getMessage())) .onSuccess(ep -> { - if (getConfig().isMessageTracingLogEnabled()) { - ep.addInterceptor(new MessageTracer()); - } ep.addInterceptor(internalErrorTracer); newServer.addEndpoint(ep); this.secureEndpoint = ep; @@ -209,9 +205,6 @@ protected Resource createRoot() { final Future insecureEndpointFuture = endpointFactory.getInsecureEndpoint() .onFailure(t -> log.info("not creating insecure endpoint: {}", t.getMessage())) .onSuccess(ep -> { - if (getConfig().isMessageTracingLogEnabled()) { - ep.addInterceptor(new MessageTracer()); - } ep.addInterceptor(internalErrorTracer); newServer.addEndpoint(ep); this.insecureEndpoint = ep; diff --git a/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/CoapAdapterOptions.java b/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/CoapAdapterOptions.java index f5bfd29243..e71688c0d8 100644 --- a/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/CoapAdapterOptions.java +++ b/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/CoapAdapterOptions.java @@ -152,14 +152,4 @@ public interface CoapAdapterOptions { */ @WithDefault("500") int timeoutToAck(); - - /** - * Checks, if message tracing log is enabled. - *

- * When enabled, the CoAP adapter will log all incoming and outgoing messages tracing information. - * - * @return {@code true} enable message tracing log, {@code false} disable message tracing log. - */ - @WithDefault("false") - boolean messageTracingLogEnabled(); } diff --git a/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/CoapAdapterProperties.java b/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/CoapAdapterProperties.java index b303b46288..1cd149dc64 100644 --- a/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/CoapAdapterProperties.java +++ b/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/CoapAdapterProperties.java @@ -66,11 +66,6 @@ public class CoapAdapterProperties extends ProtocolAdapterProperties { * that time, the status gets removed and a new request will fail. */ public static final int DEFAULT_BLOCKWISE_STATUS_LIFETIME = 300000; - /** - * The default for message tracing log. When message tracing is enabled, the CoAP adapter - * will log all incoming and outgoing messages. This is useful for debugging purposes. - */ - public static final boolean DEFAULT_MESSAGE_TRACING_LOG = false; static { DEFAULT_CONNECTOR_THREADS = 2; @@ -96,7 +91,6 @@ public class CoapAdapterProperties extends ProtocolAdapterProperties { private int blockwiseStatusLifetime = DEFAULT_BLOCKWISE_STATUS_LIFETIME; private boolean messageOffloadingEnabled = DEFAULT_MESSAGE_OFFLOADING; private int timeoutToAck = DEFAULT_TIMEOUT_TO_ACK; - private boolean messageTracingLogEnabled = DEFAULT_MESSAGE_TRACING_LOG; /** * Creates properties using default values. @@ -123,7 +117,6 @@ public CoapAdapterProperties(final CoapAdapterOptions options) { this.networkConfig = options.networkConfig().orElse(null); this.secureNetworkConfig = options.secureNetworkConfig().orElse(null); setTimeoutToAck(options.timeoutToAck()); - this.messageTracingLogEnabled = options.messageTracingLogEnabled(); } /** @@ -473,27 +466,4 @@ public final void setTimeoutToAck(final int timeoutToAck) { } this.timeoutToAck = timeoutToAck; } - - /** - * Returns the current message tracing log mode. - *

- * When message tracing is enabled, the CoAP adapter will log all incoming and outgoing messages. - *

- * @return {@code true} if message tracing log is enabled, {@code false} if it's disabled. - */ - public final boolean isMessageTracingLogEnabled() { - return messageTracingLogEnabled; - } - - /** - * Sets the message tracing log mode. - *

- * When message tracing is enabled, the CoAP adapter will log all incoming and outgoing messages. - * Setting this property has effect only during the application startup. - *

- * @param messageTracingLog {@code true} enable message tracing log, {@code false} disable message tracing log. - */ - public final void setMessageTracingLogEnabled(final boolean messageTracingLog) { - this.messageTracingLogEnabled = messageTracingLog; - } } diff --git a/site/documentation/content/admin-guide/coap-adapter-config.md b/site/documentation/content/admin-guide/coap-adapter-config.md index f4cc6ffd80..526e102e80 100644 --- a/site/documentation/content/admin-guide/coap-adapter-config.md +++ b/site/documentation/content/admin-guide/coap-adapter-config.md @@ -45,7 +45,6 @@ configuring the CoAP adapter. | `HONO_COAP_MAXCONNECTIONS`
`hono.coap.maxConnections` | no | `0` | The maximum number of concurrent DTLS connections that the protocol adapter should accept. If set to `0`, the protocol adapter determines a reasonable value based on the available resources like memory and CPU. | | `HONO_COAP_MAXPAYLOADSIZE`
`hono.coap.maxPayloadSize` | no | `2048` | The maximum allowed size of an incoming CoAP request's body in bytes. Requests with a larger body size are rejected with a 4.13 `Request entity too large` response. | | `HONO_COAP_MESSAGEOFFLOADINGENABLED`
`hono.coap.messageOffloadingEnabled` | no | true | Enables to clear payload and serialized messages kept for deduplication in order to reduce the heap consumption. Experimental. | -| `HONO_COAP_MESSAGETRACINGLOGENABLED`
`hono.coap.messageTracingLogEnabled` | no | `false` | If set to `true` the protocol adapter will start to log every incoming and outgoing CoAP messages with tracing information (message connection information, request code, confirmable and confirmed details, MID, token, options, status and the payload partially). | | `HONO_COAP_NETWORKCONFIG`
`hono.coap.networkConfig` | no | - | The absolute path to a Californium properties file containing network configuration properties that should be used for the insecure and secure CoAP port. If not set, Californium's default properties will be used. Values may be overwritten using the specific `HONO_COAP_INSECURENETWORKCONFIG` or `HONO_COAP_SECURENETWORKCONFIG`. If the file is not available, not readable or malformed, the adapter will fail to start. | | `HONO_COAP_PORT`
`hono.coap.port` | no | - | The secure port that the protocol adapter should listen on.
See [Port Configuration]({{< relref "#port-configuration" >}}) below for details. | | `HONO_COAP_SECURENETWORKCONFIG`
`hono.coap.secureNetworkConfig` | no | - | The absolute path to a Californium properties file containing network configuration properties that should be used for the secure CoAP port. If not set, Californium's default properties will be used. If the file is not available, not readable or malformed, the adapter will fail to start. |