Skip to content

Configurable access and error logging#19

Open
kilgor-trout-c22 wants to merge 10 commits into
mainfrom
enh/logging-concept
Open

Configurable access and error logging#19
kilgor-trout-c22 wants to merge 10 commits into
mainfrom
enh/logging-concept

Conversation

@kilgor-trout-c22

Copy link
Copy Markdown
Collaborator

Adds configurable logging to the image and documents it in docs/logging.md.

Access & error logs

  • Configurable HTTP access log (opt-in, off by default): json/console format, stdout or a rolled file under /data, Mercure authorization query param redacted.
  • Configurable server runtime/error log (Caddy default logger): level, format, stdout/stderr/file, or disabled.
  • Split the frankenphp streams so stdout = access log and stderr = diagnostics + PHP errors; enabled PHP log_errors (with display_errors Off).

Process output

  • Scheduler, worker and the app.log mirror prefix each line with their supervisor process name (e.g. [humhub-scheduler], [humhub-worker_00], [humhub-app-log]).
  • stopasgroup/killasgroup for the programs that fork children.
  • app.log is pre-created and mirrored to stdout by default (opt-out).

Env vars

HUMHUB_DOCKER__ACCESS_LOG[_FORMAT|_OUTPUT|_FILE|_ROLL_SIZE|_ROLL_KEEP], HUMHUB_DOCKER__SERVER_LOG[_LEVEL|_FORMAT|_OUTPUT|_FILE], HUMHUB_DOCKER__APP_LOG_STDOUT. Full reference in docs/logging.md.

Notes

  • Client-IP / trusted-proxy handling is intentionally left to the reverse-proxy operator; documented as an opt-in via the base image's CADDY_GLOBAL_OPTIONS.
  • Verified against a real build: config validates with the FrankenPHP engine, file/stdout/console variants work, PHP error routing confirmed, prefixes and stream split confirmed live.

Introduce access log (site) and server log (Caddy default logger) with
stdout/file output, JSON/console format, level and roll controls via
HUMHUB_DOCKER__* env vars. Split frankenphp stdout/stderr streams,
enable PHP log_errors, add optional app.log stdout mirror, and document
the concept in docs/logging.md.
Merge all php_ini directives into one heredoc to avoid the trailing-newline
concatenation that produced an invalid directive. Default access log to off
(too verbose) and drop the redundant PHP defaults comment.
Prefix each scheduler/worker output line with the supervisor process name
(distinguishes worker_00/_01) and drop the now-redundant Cron:/Worker: text.
Add stopasgroup/killasgroup so their child processes shut down cleanly, and
unify supervisord log paths to /dev/stdout and /dev/stderr.
Run the app.log mirror through a wrapper script so each line is prefixed with
the supervisor process name (like scheduler/worker), and signal its group on
stop. Document the process prefixes as the primary way to tell sources apart.
Leave trusted-proxy/client-IP handling to the reverse-proxy operator instead of
configuring it in the image. Document the opt-in via the base image's
CADDY_GLOBAL_OPTIONS variable, with a GDPR note.
Also document the server-log file rotation defaults (Caddy 100 MiB / 10 files / 90 days).
@kilgor-trout-c22
kilgor-trout-c22 requested a review from luke- July 17, 2026 14:37
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.

2 participants