Skip to content

fix: drive file logs - #1395

Merged
shumkov merged 1 commit into
v0.25-devfrom
fix/dashmate/drive-log
Sep 15, 2023
Merged

shumkov merged 1 commit into
v0.25-devfrom
fix/dashmate/drive-log

Conversation

@shumkov

@shumkov shumkov commented Sep 15, 2023 •

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

After switching JS Drive to RS Drive the ABCI log file configuration has not been working in dashmate.

What was done?

  • Update RS Drive ABCI log configuration:
    • File path instead of dir path
    • String preset for verbosity levels instead of number
    • CLI verbosity flag changed to 3 items max
    • Define only one default logger (stdout)
    • Hide logs for tests by default
    • Small refactoring
  • Set correct paths to Drive ABCI logs for local network

How Has This Been Tested?

Manually

Breaking Changes

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@shumkov shumkov added this to the v0.25.0 milestone Sep 15, 2023
@shumkov shumkov changed the title fix(dashmate): drive logs configuration fix: drive file logs Sep 15, 2023
@shumkov
shumkov merged commit 4da4a17 into v0.25-dev Sep 15, 2023
@shumkov
shumkov deleted the fix/dashmate/drive-log branch September 15, 2023 14:01
shumkov added a commit that referenced this pull request Sep 16, 2023
@shumkov shumkov mentioned this pull request Sep 16, 2023
Comment thread packages/dashmate/docker-compose.yml Resolved
const drivePrettyFilePath = homeDir.joinPath('logs', config.getName(), 'drive-pretty.log');
config.set('platform.drive.abci.log.prettyFile.path', drivePrettyFilePath);

const driveJsonFilePath = homeDir.joinPath('logs', config.getName(), 'drive-json.log');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you test it with max_files > 0 ? AFAIR you can kill -HUP drive-abci to force log rotation.

For max_files == 0 HUP executes flush() so should be called as part of external logrotate

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Nope, I didn't test. In deployment tool we use external log rotate. Do you think we should expose flush command for Drive so log rotate will call it? Do you think it's a big deal? In worst case scenario we just add lines to new file instead of old one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See https://unix.stackexchange.com/questions/440004/why-is-kill-hup-used-in-logrotate-in-rhel-is-it-necessary-in-all-cases

Looks like with logrotate, we need to handle this signal a bit different - close and recreate the file; otherwise writes could still go to old file, regardless of the move done by logrotate.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

And your change might be a breaking change for max_files > 0 - I mean, it can stop working. That's why I suggested this test.

destination: String::from("stderr"),
verbosity: 0,
color: None,
destination: LOG_DESTINATION_STDOUT.to_string(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what do you think about using LogDestination::name(&LogDestination::StdOut); instead of constants?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We can do it but then we need to change LogDestination::Bytes name to "bytes", or change destination config option to "ByteBuffer". What do you prefer?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

   #[cfg(test)]
    // Just some bytes, for testing
    Bytes(Writer<Vec<u8>>),

I don't care, as this is only for testing. Can be ByteBuffer.

@shumkov shumkov Sep 18, 2023 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It works for StdErr and StdOut because these variants don't have params but doesn't work for Bytes since it requires Writer so you can't do LogDestination::name(&LogDestination::Bytes);

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.

3 participants