Skip to content

How to emit span lifecycle activity logs of enter/exit/closed events? #2130

Answered by hawkw
maowen asked this question in Q&A
Discussion options

You must be logged in to vote

The span activity events you're referring to are log records, from the log crate. They are not tracing events, and are only emitted when tracing's log backwards-compatibility feature is enabled. This is because tracing subscribers can natively consume span activity without requiring special log records, while the log crate is not aware of the concept of "spans" and this mechanism is the only way log users can record this data.

In your code, you're not using the log crate; instead, you're using tracing_subscriber::fmt to log tracing events. The fmt subscriber is also aware of span activity, but it doesn't emit a log line by default when spans are created/entered/exited/closed. Instead, it …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@maowen
Comment options

Answer selected by maowen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants