WebSphere Liberty OpenTelemetry log Recipe
WebSphere Liberty OpenTelemetry may be used to periodically log performance statistics to disk.
- The
mpTelemetryfeature must be installed. If needed, verify withproductInfo; for example:$ LIBERTY/bin/productInfo featureInfo | grep mpTelemetry mpTelemetry-2.1- If it's not installed, you may install it with
installUtilityand then restart Liberty; for example:LIBERTY/bin/installUtility install mpTelemetry-2.1
- If it's not installed, you may install it with
- Set the following environment variables to send the data to
messages.log; for example, inserver.env.OTEL_SDK_DISABLED=false OTEL_SERVICE_NAME=otellog OTEL_LOGS_EXPORTER=none OTEL_TRACES_EXPORTER=none OTEL_METRICS_EXPORTER=console OTEL_JAVA_DISABLED_RESOURCE_PROVIDERS=io.opentelemetry.instrumentation.resources.HostResourceProvider,io.opentelemetry.instrumentation.resources.ProcessResourceProvider,io.opentelemetry.instrumentation.resources.OsResourceProvider,io.opentelemetry.instrumentation.resources.ProcessRuntimeResourceProvider - Add the
mpTelemetry-2.1feature toserver.xml(or aconfigDropinoverride). For example:<featureManager><feature>mpTelemetry-2.1</feature></featureManager>- Note that Liberty defaults
to a maximum of 20MB for
messages.logwith up to one historical file. If needed, you may increase this; for example, for a total of up to 1GB with 10 files up to 100MB each:<logging maxFileSize="100" maxFiles="10" />
- Note that Liberty defaults
to a maximum of 20MB for
- Restart Liberty.
- Approximately every minute, you should see OpenTelemetry statistics
output in
messages.log; for example, here's a statistic output for active threads (io.openliberty.threadpool.active_threads) for theDefault Executorthread pool showingvalue=0over 3 minutes:[8/19/26, 10:39:21:572 CDT] 00000045 io.opentelemetry.exporter.logging.LoggingMetricExporter I metric: ImmutableMetricData{resource=Resource{schemaUrl=null, attributes={service.instance.id="8b388da6-56ea-4920-8b1c-23076e381adf", service.name="otellog", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.48.0"}}, instrumentationScopeInfo=InstrumentationScopeInfo{name=io.openliberty.monitor.metrics, version=null, schemaUrl=null, attributes={}}, name=io.openliberty.threadpool.active_threads, description=The number of threads that are actively running tasks., unit={thread}, type=LONG_SUM, data=ImmutableSumData{points=[ImmutableLongPointData{startEpochNanos=1787153901540000000, epochNanos=1787153961544000000, attributes={io.openliberty.threadpool.name="Default Executor"}, value=0, exemplars=[]}], monotonic=false, aggregationTemporality=CUMULATIVE}} [8/19/26, 10:40:21:559 CDT] 00000045 io.opentelemetry.exporter.logging.LoggingMetricExporter I metric: ImmutableMetricData{resource=Resource{schemaUrl=null, attributes={service.instance.id="8b388da6-56ea-4920-8b1c-23076e381adf", service.name="otellog", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.48.0"}}, instrumentationScopeInfo=InstrumentationScopeInfo{name=io.openliberty.monitor.metrics, version=null, schemaUrl=null, attributes={}}, name=io.openliberty.threadpool.active_threads, description=The number of threads that are actively running tasks., unit={thread}, type=LONG_SUM, data=ImmutableSumData{points=[ImmutableLongPointData{startEpochNanos=1787153901540000000, epochNanos=1787154021544000000, attributes={io.openliberty.threadpool.name="Default Executor"}, value=0, exemplars=[]}], monotonic=false, aggregationTemporality=CUMULATIVE}} [8/19/26, 10:41:21:550 CDT] 00000045 io.opentelemetry.exporter.logging.LoggingMetricExporter I metric: ImmutableMetricData{resource=Resource{schemaUrl=null, attributes={service.instance.id="8b388da6-56ea-4920-8b1c-23076e381adf", service.name="otellog", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.48.0"}}, instrumentationScopeInfo=InstrumentationScopeInfo{name=io.openliberty.monitor.metrics, version=null, schemaUrl=null, attributes={}}, name=io.openliberty.threadpool.active_threads, description=The number of threads that are actively running tasks., unit={thread}, type=LONG_SUM, data=ImmutableSumData{points=[ImmutableLongPointData{startEpochNanos=1787153901540000000, epochNanos=1787154081545000000, attributes={io.openliberty.threadpool.name="Default Executor"}, value=0, exemplars=[]}], monotonic=false, aggregationTemporality=CUMULATIVE}} - Reproduce the problem.
- Upload the following files:
logs/messages*loglogs/console.loglogs/ffdc/*