-
Notifications
You must be signed in to change notification settings - Fork 349
Feature support set level of logger#777
Feature support set level of logger#777zhuliquan wants to merge 3 commits intoArroyoSystems:masterfrom
Conversation
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.
5c0911f to
ce14784
Compare
ce14784 to
7ab913a
Compare
| } | ||
|
|
||
| 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=debugI 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
config()
.logging
.min_level
.clone()
.unwrap_or("info".to_string()),
);