swift-otel icon indicating copy to clipboard operation
swift-otel copied to clipboard

Ability to multiplex logs to stdout as well as OTLP

Open czechboy0 opened this issue 8 months ago • 0 comments
trafficstars

This is a suggestion for the 1.0 roadmap - once there's full support for exporting logs over OTLP, there still remains the need for a service to emit at least some logs to stdout/stderr.

For one, there might be logs emitted before the OTLP logs exporter is bootstrapped, and we shouldn't lose those.

Separately, I think we should make it easy to configure to always emit logs to stdout/stderr even when exporting to OTLP is working as expected.

Especially for containerized Swift apps, if you print the logs of a service, it'd be great if it's not empty.

Now, one way to handle this is by configuring the debug exporter in a sidecar otel-collector - and that might be enough (as long as we expect the localhost connection between the app and otel-collector to be reliable).

Another way would be to have some alsoLogInProcess: Bool flag on the new streamlined bootstrap APIs. Maybe it'd be expected that when bringing up a service, you'd enable this option and once everything works end-to-end, some adopters might turn it off. Others might always keep it on.

I think this is really only relevant for logs, which are often the tool of last resort when debugging issues. And pragmatically, if we're failing to export to OTLP, it'd be good to see those errors logged somewhere.

czechboy0 avatar Mar 14 '25 06:03 czechboy0