fix(connlib): recreate log file if it got deleted#8926
Merged
thomaseizinger merged 5 commits intomainfrom Apr 29, 2025
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses the issue where logs are lost when the current log file is deleted by adding a check to recreate the file before writing logs.
- Adds file existence checking and file recreation logic in the Appender implementation.
- Introduces tests to validate that the log file is correctly recreated after deletion.
- Updates the clear_logs functionality in the headless-client to only target .log files.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| rust/logging/src/file.rs | Implements re-creating the log file if it was deleted. |
| rust/logging/Cargo.toml | Adds a dependency on tempfile for testing purposes. |
| rust/headless-client/src/clear_logs.rs | Simplifies clearing logic to focus solely on .log files. |
Comment on lines
+123
to
+124
| if !std::fs::exists(self.directory.join(&filename)).unwrap_or_default() => | ||
| { |
There was a problem hiding this comment.
The use of unwrap_or_default() is incorrect as std::fs::exists returns a bool rather than a Result. Remove unwrap_or_default() to ensure the file existence is checked correctly.
Suggested change
| if !std::fs::exists(self.directory.join(&filename)).unwrap_or_default() => | |
| { | |
| if !std::fs::exists(self.directory.join(&filename)) => |
Member
Author
There was a problem hiding this comment.
Go home Copilot, you are drunk.
thomaseizinger
commented
Apr 29, 2025
424ce97 to
6a948fb
Compare
jamilbk
approved these changes
Apr 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, when
connlib's log file gets deleted, we write logs into nirvana until the corresponding process gets restarted. This is painful for users to do because they need to restart the IPC service or Network Extension. Instead, we can simply check if the log file exists prior to writing to it and re-create it if it doesn't.Resolves: #6850
Related: #7569