bevyengine / bevyengine/bevy

Disabling logging with `log` crate and it's features doesn't work

Open
#17,226 1 comment 1 reaction 0 assignees View on GitHub
A-Diagnostics C-Bug S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version

`0.15.0`, `0.15.1`

## What you did

This dependencies:
```toml
[dependencies]
bevy = "0.15.1"
log = { version = "*", features = [
"max_level_off",
"release_max_level_off"
] }
```
and this app (doesn't matter if it's `debug` or `release` build):
```rust
use bevy::prelude::*;

fn main() -> AppExit {
App::new().add_plugins(DefaultPlugins).add_systems(Startup, || {
error!("this shouldn't happen!");
}).run()
}
```
will print into console:
```
2025-01-07T23:59:05.547370Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 11 Enterprise", kernel: "22631", cpu: "AMD Ryzen 9 5900X 12-Core Processor", core_count: "12", memory: "63.9 GiB" }
2025-01-07T23:59:05.742910Z INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce GTX 1080", vendor: 4318, device: 7040, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "566.36", backend: Vulkan }
2025-01-07T23:59:05.936074Z INFO bevy_winit::system: Creating new window "App" (0v1#4294967296)
2025-01-07T23:59:05.965325Z ERROR bevy_log_test: this shouldn't happen!
```
and then when we close the window:
```
2025-01-07T23:59:08.711962Z INFO bevy_window::system: No windows are open, exiting
2025-01-07T23:59:08.712379Z INFO bevy_winit::system: Closing window 0v1#4294967296
2025-01-07T23:59:08.712897Z INFO bevy_window::system: No windows are open, exiting
```

## What went wrong

Bevy's page says [here](https://bevyengine.org/learn/quick-start/getting-started/setup/#improve-runtime-performance-optional) that `log`'s features can be used to disable logging below that level.

This:
```toml
log = { version = "*", features = [
"max_level_off",
"release_max_level_off"
] }
```
should disable all logging in `debug`/`release` but I can still see logs in console.

Using bevy's setup's features:
```toml
log = { version = "*", features = [
"max_level_debug",
"release_max_level_warn"
] }
```
still result's in `info` logs in console in `release` mode.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the provided Bevy 0.15.1 dependency features and sample application, then inspect Bevy's logging setup and the linked runtime-performance documentation. Done means the documented log features suppress the expected log levels in both debug and release builds.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.