Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release logging is capped at info #1206

Closed
barsoosayque opened this issue Jan 4, 2021 · 5 comments
Closed

Release logging is capped at info #1206

barsoosayque opened this issue Jan 4, 2021 · 5 comments
Labels
C-Usability A targeted quality-of-life change that makes Bevy easier to use

Comments

@barsoosayque
Copy link
Contributor

barsoosayque commented Jan 4, 2021

Building a bevy app in release mode sets the static max level of tracing to info. Here is the warning I get:

warning: some trace filter directives would enable traces that are disabled statically
 | `debug` would enable the DEBUG level for all targets
 = note: the static max level is `info`
 = help: to enable DEBUG logging, remove the `max_level_info` feature

I've tried:

  • Setting LogSettings::level to DEBUG (Obviously, wouldn't help, since the problem is at compile time)
  • Declaring [dependencies.tracing] with features = ["release_max_level_debug"], but it seems that out of two levels, tracing still picks info.

As far as I understand, currently it is not possible to remove a feature from a transitive dependency, and because "release_max_level_info" is not a default feature of tracing, it's also impossible to disable it using default-features = false. Am I missing something ?

If there is no solution, I propose removing bevy_utils/tracing/release_max_level_info, and simply move the responsibility to users.

@cart
Copy link
Member

cart commented Jan 4, 2021

I think thats a fair take. I'm just a bit worried that most people won't think to do this and a significant percentage of bevy games will be released with measurably slower builds.

Before changing this default, I'd like to see a frame time comparison of the feature enabled/disabled for something that renders a lot of entities (maybe bevymark).

@cart cart added the C-Feature A new feature, making something new possible label Jan 4, 2021
@Ratysz
Copy link
Contributor

Ratysz commented Jan 5, 2021

It should possible to re-export that feature in Bevy, and make the re-export enabled by default. That way it retains current behavior while also allowing users to disable it.

@wendivoid
Copy link
Contributor

This has been a mildly annoying issue for me lately. I only have a horribly underpowered laptop so when using rapier i must compile in release mode, and not having the log kinda sucks honestly.

Ratysz is right i believe, bevy can re-export the features from tracing preserving the current behavior like this:

[features]
default = ["tracing/release_max_level_info"]
release_max_level_debug = ["tracing/release_max_level_debug"]
release_max_level_trace = ["tracing/release_max_level_trace"]

I'd like to fix this i just have a couple questions.

  1. Should bevy crate re-export the features as well or just bevy_utils? I'm pretty sure a user could then specify bevy_utils = { features = ["release_max_level_debug"], .. } in Cargo.toml to activate the feature
  2. Should any other tracing features be re-exported? A quick glance at tracings Cargo.toml the relevant features are:
    • max_level_debug
    • max_level_error
    • max_level_info
    • max_level_off
    • max_level_trace
    • max_level_warn
    • release_max_level_debug
    • release_max_level_error
    • release_max_level_info
    • release_max_level_off
    • release_max_level_trace
    • release_max_level_warn
      The only 2 that really apply are release_max_level_debug & release_max_level_trace
  3. Should the feature name stay they same? It makes sense in tracings context to only use the name 'release_max_level_debug' but bevy_utils isn't only logging 'release_max_log_level_debug' gives a bit more context.

@mockersf
Copy link
Member

Should bevy crate re-export the features as well or just bevy_utils? I'm pretty sure a user could then specify bevy_utils = { features = ["release_max_level_debug"], .. } in Cargo.toml to activate the feature

I think the Bevy root crate needs to re-export the features and the default one need to be set at this level to be disable-able by the end user

Should any other tracing features be re-exported?

I would go with all the release_* ones as that's probably the ones that makes the most sense to use in a game

Should the feature name stay they same?

I think so, to help discoverability, but not sure

This has been a mildly annoying issue for me lately. I only have a horribly underpowered laptop so when using rapier i must compile in release mode, and not having the log kinda sucks honestly.

Side note, but if you put in your Cargo.toml

[profile.dev.package."*"]
opt-level = 3

your dependencies will be built in release but not your own code, which should allow for enough optimisations while still running your code in debug

@wendivoid
Copy link
Contributor

Oh snap, Sorry for waiting so long to reply, I must have missed this. Hmm i didn't know you could use wildcards there.

My project is split into many sub crates that i want to be compiled in debug mode, i found the best way around this (for me) is to use the snippet above and specify my crates as being compiled in debug mode with

[profile.dev.package.crate-name]
opt-level = 1

Thanks for your help @mockersf

@alice-i-cecile alice-i-cecile added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Log and removed C-Feature A new feature, making something new possible labels Mar 21, 2022
bors bot pushed a commit that referenced this issue Apr 25, 2022
# Objective

- Debug logs are useful in release builds, but `tracing` logs are hard-capped (`release_max_level_info`) at the `info` level by `bevy_utils`.

## Solution

- This PR simply removes the limit in `bevy_utils` with no further actions.
- If any out-of-the box performance regressions arise, the steps to enable this `tracing` feature should be documented in a user guide in the future.

This PR closes #4069 and closes #1206.

## Alternatives considered

- Instruct the user to build with `debug-assertions` enabled: this is just a workaround, as it obviously enables all `debug-assertions` that affect more than logging itself.
- Re-exporting the feature from `tracing` and enabling it by default: I believe it just adds complexity and confusion, the `tracing` feature can also be re-enabled with one line in userland.

---

## Changelog

### Fixed

- Log level is not hard capped at `info` for release builds anymore.

## Migration Guide

- Maximum log levels for release builds is not enforced by Bevy anymore, to omit "debug" and "trace" level logs entirely from release builds, `tracing` must be added as a dependency with its `release_max_level_info` feature enabled in `Cargo.toml`. (`tracing = { version = "0.1", features = ["release_max_level_info"] }`)
exjam pushed a commit to exjam/bevy that referenced this issue May 22, 2022
# Objective

- Debug logs are useful in release builds, but `tracing` logs are hard-capped (`release_max_level_info`) at the `info` level by `bevy_utils`.

## Solution

- This PR simply removes the limit in `bevy_utils` with no further actions.
- If any out-of-the box performance regressions arise, the steps to enable this `tracing` feature should be documented in a user guide in the future.

This PR closes bevyengine#4069 and closes bevyengine#1206.

## Alternatives considered

- Instruct the user to build with `debug-assertions` enabled: this is just a workaround, as it obviously enables all `debug-assertions` that affect more than logging itself.
- Re-exporting the feature from `tracing` and enabling it by default: I believe it just adds complexity and confusion, the `tracing` feature can also be re-enabled with one line in userland.

---

## Changelog

### Fixed

- Log level is not hard capped at `info` for release builds anymore.

## Migration Guide

- Maximum log levels for release builds is not enforced by Bevy anymore, to omit "debug" and "trace" level logs entirely from release builds, `tracing` must be added as a dependency with its `release_max_level_info` feature enabled in `Cargo.toml`. (`tracing = { version = "0.1", features = ["release_max_level_info"] }`)
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective

- Debug logs are useful in release builds, but `tracing` logs are hard-capped (`release_max_level_info`) at the `info` level by `bevy_utils`.

## Solution

- This PR simply removes the limit in `bevy_utils` with no further actions.
- If any out-of-the box performance regressions arise, the steps to enable this `tracing` feature should be documented in a user guide in the future.

This PR closes bevyengine#4069 and closes bevyengine#1206.

## Alternatives considered

- Instruct the user to build with `debug-assertions` enabled: this is just a workaround, as it obviously enables all `debug-assertions` that affect more than logging itself.
- Re-exporting the feature from `tracing` and enabling it by default: I believe it just adds complexity and confusion, the `tracing` feature can also be re-enabled with one line in userland.

---

## Changelog

### Fixed

- Log level is not hard capped at `info` for release builds anymore.

## Migration Guide

- Maximum log levels for release builds is not enforced by Bevy anymore, to omit "debug" and "trace" level logs entirely from release builds, `tracing` must be added as a dependency with its `release_max_level_info` feature enabled in `Cargo.toml`. (`tracing = { version = "0.1", features = ["release_max_level_info"] }`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants