OctoPrint / OctoPrint/OctoPrint

[Request] Ability to disable all log files

Open
#4,956 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

request
Dominant language
Python
Stars
9.1k
Forks
1.7k
Avg merge
2d 5h
Merged PRs (30d)
4

Description

Is your feature request related to a problem? Please describe.

I want to run OctoPrint off of a read-only/overlay file system to prevent SD card corruption due to unclean shutdowns.

For that, I have configured all services to only emit logs to journald via stderr or syslog, which keeps 10 MB worth of logs in memory. However, OctoPrint does not seem to have a forward-compatible way of turning off log file creation, even if its stdout logs are already processed by journald.

While it is technically not a critical issue for OctoPrint to create redundant log files in the overlayfs, this feels very unclean, uses up a potentially large amount of RAM (with data that journald already keeps a copy of), and makes "clean" integration with log aggregators impossible.

Describe the solution you'd like

Some kind of setting that disables any and all log file output.

Describe alternatives you've considered

The logging.yaml file can be used to override individual log handlers. I believe this can be used to accomplish what I want (haven't tried it yet), if I write enough duplicate YAML entries, but the instant another file logger gets added to the code I would end up with a log file again, so this is not forwards-compatible:

https://github.com/OctoPrint/OctoPrint/blob/65a5533c5d645f7033f01056c8ef735a938339f0/src/octoprint/__init__.py#L302-L359

I have also tried to change the log file path to /noaccess in config.yaml, a directory that doesn't exist and OctoPrint doesn't have permission to create. However, it "helpfully" detects this and falls back to .octoprint/logs.

I have also tried to make the file permissions of .octoprint/logs read-only, which makes OctoPrint fail to start up completely.

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the logging setup in src/octoprint/init.py around lines 302-359, then review logging.yaml and the log-path handling in config.yaml. Determine how a setting could disable every file logger while retaining stderr or syslog output, and verify that OctoPrint starts without creating log files or falling back to .octoprint/logs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.