-
Notifications
You must be signed in to change notification settings - Fork 734
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
EnvFilter::from_default_env() prints warning when RUST_LOG is not set #2046
Comments
hawkw
pushed a commit
that referenced
this issue
Apr 8, 2022
…#2052) ## Motivation See issue #2046. When using calling [`Builder::parse`] or [`Builder::parse_lossy`] with an empty string an error is produced. This happens for example when `EnvFilter::from_default_env()` is called, but the `RUST_LOG` variable is unset. This regression was introduced by #2035. ## Solution Filter any empty directives. This allows the whole string to be empty, as well as leading and trailing commas. A unit test was added for [`Builder::parse`], but not [`Builder::parse_lossy`] because it (per definition) doesn't produce any side effects visible from tests when erroring. Fixes #2046 [`Builder::parse`]: https://github.com/tokio-rs/tracing/blob/cade7e311848227348c9b3062e4a33db827a0390/tracing-subscriber/src/filter/env/builder.rs#L151= [`Builder::parse_lossy`]: https://github.com/tokio-rs/tracing/blob/cade7e311848227348c9b3062e4a33db827a0390/tracing-subscriber/src/filter/env/builder.rs#L135=
hawkw
pushed a commit
that referenced
this issue
Apr 9, 2022
…#2052) ## Motivation See issue #2046. When using calling [`Builder::parse`] or [`Builder::parse_lossy`] with an empty string an error is produced. This happens for example when `EnvFilter::from_default_env()` is called, but the `RUST_LOG` variable is unset. This regression was introduced by #2035. ## Solution Filter any empty directives. This allows the whole string to be empty, as well as leading and trailing commas. A unit test was added for [`Builder::parse`], but not [`Builder::parse_lossy`] because it (per definition) doesn't produce any side effects visible from tests when erroring. Fixes #2046 [`Builder::parse`]: https://github.com/tokio-rs/tracing/blob/cade7e311848227348c9b3062e4a33db827a0390/tracing-subscriber/src/filter/env/builder.rs#L151= [`Builder::parse_lossy`]: https://github.com/tokio-rs/tracing/blob/cade7e311848227348c9b3062e4a33db827a0390/tracing-subscriber/src/filter/env/builder.rs#L135=
cgwalters
added a commit
to cgwalters/rpm-ostree
that referenced
this issue
Apr 9, 2022
We managed to ship this bug in the current 2022.6 release: tokio-rs/tracing#2046 Which is definitely embarassing enough to cut a new release.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
Version
Platform
macOS
Description
EnvFilter
from tracing-subscriber 0.3.10 printsignoring ``: invalid filter directive
when theRUST_LOG
environment variable is not set. I believe this is caused by the new Builder'sfrom_env_lossy
function usingunwrap_or_default()
which will return an empty string when the env var is not set: https://github.com/tokio-rs/tracing/blob/master/tracing-subscriber/src/filter/env/builder.rs#L166The text was updated successfully, but these errors were encountered: