Details
-
Fix
-
Status: Released (View Workflow)
-
Medium
-
Resolution: Fixed
-
2.8.3
-
None
Description
We received the following problem report:
Summary
When the JS7 Controller (2.8.3) is started with the OpenTelemetry Java agent (-javaagent:/opt/opentelemetry-javaagent.jar), every log event triggers a java.lang.UnsupportedOperationException: entrySet originating from JS7's own js7.base.log.log4j.Log4jMap.
Environment
- JS7 Controller: 2.8.3
- OpenTelemetry Java agent: 2.29.0
- Log4j: 2.24.3
Root Cause
JS7's Log4jMap intentionally does not implement entrySet():
def entrySet(): util.Set[Map.Entry[String, String]] =
throw new UnsupportedOperationException("entrySet")
The OpenTelemetry agent's Log4j context-data (MDC) instrumentation injects trace/span context into Log4j's ThreadContext. Log4j's ThreadContextDataInjector then calls HashMap.putMapEntries → Log4jMap.entrySet(), which throws.
Impact
- Log events (ControllerInitialized, ControllerReady, Prometheus /metrics startup, etc.) are not written to the log.
- Appender creation also fails: Could not create plugin ... RollingRandomAccessFileAppender: UnsupportedOperationException: entrySet.
- The controller still starts and becomes ready, but logging is kinda broken while the OTel agent is active.
Steps to Reproduce
- Start the JS7 Controller with:
JAVA_OPTIONS=-javaagent:/opt/opentelemetry-javaagent.jar - Observe repeated UnsupportedOperationException: entrySet stack traces in the container output.
- Removing the -javaagent option eliminates the errors.
Workaround
Disable the OTel Log4j context-data injection (tracing/metrics remain functional) by use of the environment variable:
OTEL_INSTRUMENTATION_LOG4J_CONTEXT_DATA_ENABLED=false
Attachments
Issue Links
- Wiki Page
-
Wiki Page Loading...