Skip to content

Log to stdout by default in Docker - #326

Open
RealOrangeOne wants to merge 1 commit into
tchapi:mainfrom
RealOrangeOne:log-stdout
Open

RealOrangeOne wants to merge 1 commit into
tchapi:mainfrom
RealOrangeOne:log-stdout

Conversation

@RealOrangeOne

Copy link
Copy Markdown

This makes logs easier to view, and reduces write on the docker storage.

This makes logs easier to view, and reduces write on the docker storage.
@tchapi tchapi self-assigned this Nov 19, 2026
@tchapi tchapi added the enhancement New feature or request label Nov 19, 2026

@tchapi tchapi left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi and thanks @RealOrangeOne

I don't think this works as is.

LOG_FILE_PATH=/dev/stdout would certainly fail from FPM workers. In the standalone image the master runs as root and workers as www-data, so Monolog will fail to open the pipe. We should use php://stderr our php://stdout instead I guess

PS: Diagnostics::logFile() will report DANGER because is_writable(dirname($logFilePath)) is false for a pipe like that, and docs would be stale, it would need to be adjusted.

Comment thread .env
# By default, it will log in the standard Symfony directory: var/log/prod.log (for production)
# You can use /dev/null here if you want to discard logs entirely
# You can use /dev/null here if you want to discard logs entirely.
# Docker installations use /dev/stdout by default

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You only modified one of the two Dockerfiles

ENV PHP_OPCACHE_MEMORY_CONSUMPTION="256" \
PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10"
PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" \
LOG_FILE_PATH="/dev/stdout"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compose setup overrides the new default. docker/.env still sets LOG_FILE_PATH="%kernel.logs_dir%/%kernel.environment%.log"

autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/caddy/access.log
stdout_logfile=/dev/stdout

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want access logs in docker logs? It's noisy ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants