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

Prevent file logging before configuration initialization #7896

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

rubo
Copy link
Contributor

@rubo rubo commented Dec 11, 2024

Changes

This PR prevents file logging before configuration initialization. The reason is that now Nethermind uses the log rules at the very beginning to avoid having sudden log style changes after loading the configuration. However, on some user configurations, the Nethermind directory is inaccessible for the Nethermind process, and that causes an error.

Another approach might be writing that part of the logs in the user's temp directory. But till now, that logs were missing, and perhaps having them in the file somewhere is not that useful.

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Tested manually.

@rubo rubo added the bug label Dec 11, 2024
@rubo rubo requested a review from LukaszRozmej December 11, 2024 19:21
@MarekM25
Copy link
Contributor

Do you know which PR could add this bug? It would be easier to understand the fix

@rubo
Copy link
Contributor Author

rubo commented Dec 11, 2024

Do you know which PR could add this bug? It would be easier to understand the fix

I don't recall which one exactly, but one of mine. Logs have been changed from this

old

to this

new

so they have their colors and formatting right from the start.

Since the configuration is not initialized at that early stage, the logger instance logs in the default data directory, i.e., the Nethermind directory. And for some setups, it causes access issues. Thus, this PR disables file logging for that stage (like we had previously) while keeping the nice logs.

@rubo rubo merged commit f29d19f into master Dec 11, 2024
79 checks passed
@rubo rubo deleted the fix/logger-init branch December 11, 2024 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants