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

Fix logger initialization on readonly filesystems #2391

Conversation

vnuka-n
Copy link
Contributor

@vnuka-n vnuka-n commented Oct 4, 2024

Calling RollingFileAppender::new tries to create the directory for the log files even though logging is turned off by Logger.init('off', null). This change simply postpones the initialization of RollingFileAppender until it is actually needed. This way if we do eg. Logger.init("info", null) it works as expected and does not throw an error on readonly filesystems.

Fixes #2387

@avifenesh
Copy link
Collaborator

avifenesh commented Oct 4, 2024

Thanks for taking the initiative! Appreciate that!

I didn't get deeply into it yet (holidays), but at first glance, it seems good, i thought also to look for a lazy appender solution.

As long as it's not urgent to you guys I'll review it on Sunday. Let me know if it is.

If you want in the meantime to add the implementation of error handling in write-only systems you are welcome to add it to the PR.

For passing CI you need to sign your commits.

@Yury-Fridlyand Yury-Fridlyand added the logger logger-core label Oct 4, 2024
Copy link
Collaborator

@Yury-Fridlyand Yury-Fridlyand left a comment

Choose a reason for hiding this comment

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

Nice!
Please apply linter suggestions to pass CI checks.

logger_core/src/lib.rs Outdated Show resolved Hide resolved
logger_core/tests/test_logger.rs Show resolved Hide resolved
logger_core/src/lib.rs Show resolved Hide resolved
@vnuka-n vnuka-n force-pushed the fix-logger-initalization-on-readonly-filesystems branch from 9ffdf46 to 3b61d8a Compare October 7, 2024 07:58
Calling RollingFileAppender::new tries to create the directory for the log files even though logging is turned off by Logger.init('off', null). This change simply postpones the initialization of RollingFileAppender until it is actually needed. This way if we do eg. Logger.init("info", null) it works as expected and does not throw an error on readonly filesystems.

Fixes valkey-io#2387

Signed-off-by: Ville Nukarinen <[email protected]>
@vnuka-n vnuka-n force-pushed the fix-logger-initalization-on-readonly-filesystems branch from 3b61d8a to 5755de3 Compare October 7, 2024 08:01
@vnuka-n
Copy link
Contributor Author

vnuka-n commented Oct 7, 2024

Signed the commit and amended all the requested changes.

Copy link
Collaborator

@avifenesh avifenesh left a comment

Choose a reason for hiding this comment

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

LGTM, let me know if you want me to merge

@vnuka-n
Copy link
Contributor Author

vnuka-n commented Oct 7, 2024

LGTM, let me know if you want me to merge

ready on my side, so go ahead 😄

@avifenesh avifenesh merged commit 109b5ba into valkey-io:main Oct 7, 2024
12 checks passed
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.

Client panics when initializing on a read only filesystem
4 participants