Add setting to disable file logging - #2570
Open
ahmershahdev wants to merge 2 commits into
Open
ahmershahdev wants to merge 2 commits into
ahmershahdev wants to merge 2 commits into
Conversation
Adds an 'Enable logging to file' checkbox (on by default) under a new Logging group in Settings. When it's off, the log file handler is removed, so logs only go to the console (e.g. journald when Vorta runs via systemd). The file handler is now created with delay=True, so no empty vorta.log is created if file logging is disabled. Fixes borgbase#1705
Contributor
|
Thanks, this follows the approach discussed in the issue. Two things before merging:
|
…ting before init_db() - In background mode, add a console handler while file logging is off, so logs are not lost. - Read the setting from the database before the logger is set up, so nothing written while init_db() runs (job recovery, migrations) ends up in vorta.log when file logging is off.
Contributor
Author
|
Thanks for your feedback, I've fixed both points: in background mode, logs now go to the console when file logging is off, and the setting is now read before the file handler is attached, so nothing from init_db() ends up in vorta.log. |
This branch has not been deployed
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.
Adds an “Enable logging to file” setting, enabled by default, so users can disable vorta.log and keep logging only to the console/journald.
Includes tests for toggling the setting and file handler behavior.
Tested on my fork before opening this: lint, mypy and the full test suite pass on Ubuntu and macOS (CI run). One of the new tests checks that no vorta.log is created while the setting is off.
Fixes #1705