-
Notifications
You must be signed in to change notification settings - Fork 229
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
Feature support set level of logger #777
base: master
Are you sure you want to change the base?
Conversation
5c0911f
to
ce14784
Compare
ce14784
to
7ab913a
Compare
.from_env_lossy(), | ||
) | ||
} | ||
|
||
fn parse_level_filter() -> LevelFilter { | ||
let level_filter = config() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want the RUST_LOG env var to have the highest precedence, so that they can override what's the in the config file as needed.
With this change, it's not possible to use RUST_LOG at all because min_level is set in defaults.toml, and always will override the env var.
Additionally, the env var supports much more than just static levels (like "info" or "warn")—it's able to completely configure the logger on a per-crate basis. For example:
RUST_LOG=info,arroyo_worker=debug,arroyo_controller=debug,arroyo_state=debug
I think an approach would be to:
- First check if the env var is set, and if so use that with
from_env_lossy
; if not we can use the min_level config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank for @mwylde review, Sorry for later reply. I agree with Env var high priority, but I don't know how to implement min log level for each sub-crate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want the RUST_LOG env var to have the highest precedence, so that they can override what's the in the config file as needed.
With this change, it's not possible to use RUST_LOG at all because min_level is set in defaults.toml, and always will override the env var.
Additionally, the env var supports much more than just static levels (like "info" or "warn")—it's able to completely configure the logger on a per-crate basis. For example:
RUST_LOG=info,arroyo_worker=debug,arroyo_controller=debug,arroyo_state=debug
I think an approach would be to:
- First check if the env var is set, and if so use that with
from_env_lossy
; if not we can use the min_level config.
parse level like this? first fetch ENV var then fetch min_level of logging config
let level_filter = std::env::var(EnvFilter::DEFAULT_ENV).unwrap_or(
config()
.logging
.min_level
.clone()
.unwrap_or("info".to_string()),
);
Hello, Every time I want to debug problem and view the logs, I always see a large number of INFO logs, sometimes I only need to look at the warn and error level logs, meanwhile printing log in terminal frequently will affect the performance. If we can control the log level through the config file will be better, so that we can debug problem in the development stage, and ensure the performance in the production stage.