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

Enable logging to a file #1856

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Enable logging to a file #1856

wants to merge 5 commits into from

Conversation

azarovh
Copy link
Member

@azarovh azarovh commented Dec 19, 2024

For GUI logging to a file is enabled by default. For other apps it's off with an option to enable it explicitly.

@azarovh azarovh marked this pull request as draft December 19, 2024 09:20
@azarovh azarovh marked this pull request as ready for review December 19, 2024 09:31
@azarovh
Copy link
Member Author

azarovh commented Dec 20, 2024

I should probably mention why I refactored the functions inside runner.rs
Mainly to separate initialization of folders and logging from actually running the node and to be able to log command line options before everything else. Also now it also seems like a better structure overall then before.

@azarovh azarovh marked this pull request as draft December 20, 2024 10:14
@azarovh azarovh marked this pull request as ready for review December 20, 2024 11:23
@@ -48,6 +49,7 @@ use crate::{
};

const LOCK_FILE_NAME: &str = ".lock";
const LOG_FILE_NAME: &str = "mintlayer.log";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the name should be based on the executable?

Comment on lines +92 to +95
/// Log to a file
#[clap(long, action = clap::ArgAction::Set)]
#[arg(hide = true)]
pub log_to_file: Option<bool>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we hide it?

(If not, the description should be more detailed, mentioning that the default value depends on the application and where the logs will be located).

Comment on lines +271 to +272
AppendCount::new(2), // total 3 file
ContentLimit::Bytes(100_000_000), // 100MB each
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100 mb seems too much for one file.

IMO we should measure roughly how much logs the node produces in a day and make it the max size. And the number of files can be e.g. 7 (or 10, or 14).

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.

2 participants