Persist Gridsync, Tahoe-LAFS, and Magic-Folder logs to disk by crwood · Pull Request #570 · gridsync/gridsync
This PR updates Gridsync's logging system to persist log messages captured from multiple sources to the local filesystem (rather than buffering logs temporarily to memory -- where they would previously be lost between application restarts; see #564). Currently, this PR captures logs from seven different sources/streams. These are:
- The Gridsync standard application log
- Tahoe-LAFS's stdout stream
- Tahoe-LAFS's stderr stream
- Tahoe-LAFS's structured (eliot) logs
- Magic-Folder's stdout stream
- Magic-Folder's stderr stream
- Magic-Folder's structured (eliot) logs
By default, captured logs will be written to individual files in the logs subdirectory beneath the Gridsync configuration directory (e.g., ~/.config/gridsync/logs on GNU/Linux) and can be viewed, exported, and optionally (but somewhat poorly) "filtered" using the previously-existing in-application debug log viewer (accessible via the menu -> "Help" -> "View Debug Information..."). The environment variable GRIDSYNC_LOGGING_PATH can be used to control the location of captured logs at runtime (and will be set to .logs during CI/test runs via tox.ini).
Other aspects of logging behavior (such as the maximum log size) can also be controlled by modifying the appropriate "logging" section of config.txt:
[logging]
enabled = true
max_bytes = 10000000
As with all other values in config.txt, these settings can be overridden at runtime via GRIDSYNC_-prefixed environment variables that correspond to the appropriate section/option/value -- for example GRIDSYNC_LOGGING_ENABLED=false to disable logging completed or GRIDSYNC_LOGGING_MAX_BYTES=20000000 to increase the maximum log filesize from 10 MB to 20 MB.
Closes #564