bevyengine / bevyengine/bevy

Tracing scopes don't interact well with App::Run()

Open
#20,801 3 comments 0 reactions 0 assignees View on GitHub
A-Diagnostics C-Bug
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version and features

- 0.16.1

## What you did

Ran this
```
fn f() {
info!("Hello, world!");
}

fn main() {
let mut app = App::new();
app.add_plugins(DefaultPlugins);

app.add_systems(Update, f);
info_span!("hi").in_scope(|| app.run());
}
```

## What went wrong

I would expect "hi" to be added to every log line, but I get:
```
2025-08-30T13:55:45.800802Z INFO hi: bevy_render::batching::gpu_preprocessing: GPU preprocessing is fully supported on this device.
2025-08-30T13:55:45.978609Z INFO hi: bevy_winit::system: Creating new window empty (0v0)
2025-08-30T13:55:46.007255Z INFO empty: Hello, world!
2025-08-30T13:55:46.437210Z INFO empty: Hello, world!
2025-08-30T13:55:48.766013Z INFO empty: Hello, world!
...
2025-08-30T13:55:51.559464Z INFO empty: Hello, world!
2025-08-30T13:55:51.559788Z INFO bevy_window::system: No windows are open, exiting
2025-08-30T13:55:51.560534Z INFO hi: bevy_winit::system: Closing window 0v0
```

"hi" is added to app internal behaviour but not to logs happening inside systems.

Contributor guide

Open the contributing guide

Research direction

Reproduce the supplied Rust example on Bevy 0.16.1, starting with App::run and the system execution path. Trace how the info_span!("hi") scope is propagated into app internals versus systems, then verify that logs from f retain the hi span while preserving the surrounding log behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev, observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.