-
Notifications
You must be signed in to change notification settings - Fork 26
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
chore(log): logging improvements #673
Conversation
mmrrnn
commented
Sep 30, 2024
- Unify dirs structure - every binary(except xmrig) has config and log dir. All are nested at the same level.
- limit logs size to 2mb, use level warn
- Create log4rs config on every run and save it to the configs dir for each binary.
c326926
to
b7b2519
Compare
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 might be overlooking the benefit of duplicating this module. What exactly is being done differently? And is it something tari_utilities
could support, so we can keep the code in one place instead of copying it over?
tari_common::initialize_logging( | ||
let contents = setup_logging( | ||
&app.path_resolver() | ||
.app_config_dir() | ||
.expect("Could not get config dir") | ||
.join("logs") | ||
.join("universe") | ||
.join("configs") | ||
.join("log4rs_config_universe.yml"), | ||
&app.path_resolver() | ||
.app_log_dir() | ||
.expect("Could not get log dir"), | ||
include_str!("../log4rs_sample.yml"), | ||
include_str!("../log4rs/universe_sample.yml"), | ||
) | ||
.expect("Could not set up logging"); | ||
let config: RawConfig = serde_yaml::from_str(&contents) | ||
.expect("Could not parse the contents of the log file as yaml"); | ||
log4rs::init_raw_config(config).expect("Could not initialize logging"); |
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.
What exactly is happening differently that tari_common::initialize_logging
wasn't doing that required duplicating this functionality?
Check out current logs structure. All binaries` logs are placed randomly, without specific structure |
I understand what the goal of the PR is. But the original code wasn't simply dropping files in random places. It was configurable. So why did we have to duplicate the function. What changed in the function fundamentally that didn't work before? If you had corrected the paths as this pr does, could we continue to use the original |
default tari logs path hardcode |
2ea10e1
to
27378f7
Compare
Tested successfully on Windows 11, app version 0.6.4 |