Skip to content

logs: Add AccessLog and RuntimeLog options for the log files - #235

Merged
jbkempf merged 1 commit into
videolabs:masterfrom
clementperon:config-log-files
Oct 20, 2026
Merged

jbkempf merged 1 commit into
videolabs:masterfrom
clementperon:config-log-files

Conversation

@clementperon

@clementperon clementperon commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Today the download log is always downloads.log in LogDir, and the runtime log can only go to a file through the daemon's -log flag. This adds two options:

Option Default Meaning
AccessLog downloads.log Access log (downloads and HEAD requests). Empty disables it.
RuntimeLog empty Runtime log. Empty keeps it on stderr; -log still takes precedence.

Relative names are created in LogDir, absolute paths are used as is. So the defaults behave exactly like today, and a setup can for example send the access log to /dev/null while keeping the runtime log in LogDir:

LogDir: /var/log/mirrorbits
AccessLog: /dev/null
RuntimeLog: runtime.log

Context: Team Kodi runs mirrors.kodi.tv with that kind of configuration (named ErrorLog there), through a patch in its fork (xbmc/mirrorbits@621f3bb). That patch renamed the default download log and joined absolute paths onto LogDir; this version keeps upstream's default and handles absolute paths.

Tests: new TestLogFilePaths covers relative and absolute names, -log precedence, and disabling the access log; make test passes for logs (also with -race). http/TestMirrorHandler3xx fails the same way on master without this change.

🤖 Generated with Claude Code

@jbkempf

jbkempf commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

LGTM

@clementperon

Copy link
Copy Markdown
Contributor Author

rebase / force push on top of master @elboulangero

@elboulangero

Copy link
Copy Markdown
Contributor

Why name the option ErrorLog? That's not a good name. It doesn't contain only errors. In the code those logs are referred to as "runtime log" (or RunLog for short), and that's a better name IMO.

AccessLog is a good name (downloads.log became a bit of a misnomer after we started to log HEAD requests in there, which are clearly NOT downloads).

@clementperon clementperon changed the title logs: Add AccessLog and ErrorLog options for the log files logs: Add AccessLog and RunLog options for the log files Oct 20, 2026
@clementperon

clementperon commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Why name the option ErrorLog? That's not a good name. It doesn't contain only errors. In the code those logs are referred to as "runtime log" (or RunLog for short), and that's a better name IMO.

AccessLog is a good name (downloads.log became a bit of a misnomer after we started to log HEAD requests in there, which are clearly NOT downloads).

I think it's to be close to what Nginx does.

I have renamed it to RuntimeLog + Update PR description

The download log is always named downloads.log in LogDir, and the
runtime log can only be redirected to a file with the -log flag of the
daemon, which means changing how mirrorbits is started.

Add two options:
- AccessLog: the access log (downloads and HEAD requests),
  "downloads.log" by default so existing setups are unchanged. An
  empty value disables it.
- RuntimeLog: the runtime log, empty by default to keep logging on
  stderr. The -log flag still takes precedence.

Relative names are created in LogDir, absolute paths are used as is,
so for example the access log can be sent to /dev/null while the
runtime log goes to a file.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@clementperon clementperon changed the title logs: Add AccessLog and RunLog options for the log files logs: Add AccessLog and RuntimeLog options for the log files Oct 20, 2026
@elboulangero

Copy link
Copy Markdown
Contributor

I think it's to be close to what Nginx does.

I've seen the parallel with web servers, but web servers really log errors in their error.log, it's quite different here (it's really a lot of informational messages that go through)

@elboulangero

Copy link
Copy Markdown
Contributor

Thanks very much @clementperon ! I've looked at the changes and it looks good, happy with it. Thanks again.

@jbkempf
jbkempf merged commit 216ef62 into videolabs:master Oct 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants