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

chore(log): logging improvements #673

Merged
merged 5 commits into from
Nov 6, 2024

Conversation

mmrrnn
Copy link
Collaborator

@mmrrnn mmrrnn commented Sep 30, 2024

  • Unify dirs structure - every binary(except xmrig) has config and log dir. All are nested at the same level.
    Screenshot from 2024-09-30 23-48-51
  • limit logs size to 2mb, use level warn
  • Create log4rs config on every run and save it to the configs dir for each binary.

@mmrrnn mmrrnn force-pushed the logging_improvements branch from c326926 to b7b2519 Compare October 9, 2024 10:27
Copy link
Collaborator

@brianp brianp left a 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?

Comment on lines -1667 to +2076
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");
Copy link
Collaborator

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?

@mmrrnn
Copy link
Collaborator Author

mmrrnn commented Oct 14, 2024

Check out current logs structure. All binaries` logs are placed randomly, without specific structure

@brianp
Copy link
Collaborator

brianp commented Oct 25, 2024

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 tari_common::initialize_logging ?

@mmrrnn
Copy link
Collaborator Author

mmrrnn commented Oct 25, 2024

default tari logs path hardcode /log nesting

@mmrrnn mmrrnn force-pushed the logging_improvements branch from 2ea10e1 to 27378f7 Compare November 6, 2024 09:53
@brianp brianp merged commit 6e02425 into tari-project:main Nov 6, 2024
9 checks passed
@Tas4tari
Copy link

Tested successfully on Windows 11, app version 0.6.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants