diff --git a/.env b/.env index 21fae532..3372437f 100644 --- a/.env +++ b/.env @@ -117,7 +117,8 @@ UPDATE_CHECK_ENABLED=false # Logging path # 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 LOG_FILE_PATH="%kernel.logs_dir%/%kernel.environment%.log" # Trust the immediate proxy for X-Forwarded-* headers including HTTPS detection. diff --git a/README.md b/README.md index 6b13c2fe..ddaf4293 100644 --- a/README.md +++ b/README.md @@ -311,7 +311,7 @@ WEBDAV_HOMES_DIR= **h. The log file path** -You can use an absolute file path here, and you can use Symfony's `%kernel.logs_dir%` and `%kernel.environment%` placeholders if needed (as in the default value). Setting it to `/dev/null` will disable logging altogether. +You can use an absolute file path here, and you can use Symfony's `%kernel.logs_dir%` and `%kernel.environment%` placeholders if needed (as in the default value). Setting it to `/dev/null` will disable logging altogether. Docker installations use `/dev/stdout` by default. ```shell LOG_FILE_PATH="%kernel.logs_dir%/%kernel.environment%.log" diff --git a/docker/Dockerfile-standalone b/docker/Dockerfile-standalone index a3a0bf2c..4aadc5dd 100644 --- a/docker/Dockerfile-standalone +++ b/docker/Dockerfile-standalone @@ -72,7 +72,8 @@ FROM base-image ENV APP_ENV=prod ENV PHP_OPCACHE_MEMORY_CONSUMPTION="256" \ - PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" + PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" \ + LOG_FILE_PATH="/dev/stdout" LABEL org.opencontainers.image.authors="tchap@tchap.me" LABEL org.opencontainers.image.url="https://github.com/tchapi/davis/pkgs/container/davis-standalone" @@ -96,11 +97,9 @@ RUN APP_ENV=prod COMPOSER_ALLOW_SUPERUSER=1 composer install --no-ansi --no-dev && php ./vendor/symfony/intl/Resources/bin/compress # Caddy: web server -RUN mkdir -p /var/log/caddy COPY ./docker/configurations/Caddyfile /etc/caddy/Caddyfile # Supervisor: Process manager -RUN mkdir -p /var/log/supervisor && mkdir -p /var/log/php-fpm COPY ./docker/configurations/supervisord.conf /etc/supervisord.conf # We want to use sockets inside the container between Caddy and PHP-fpm @@ -123,4 +122,4 @@ HEALTHCHECK --interval=120s --timeout=10s --start-period=60s --retries=3 \ CMD ["curl", "--fail", "http://localhost:9000"] # It's the Caddy port, not the PHP-fpm one (as we use sockets) -EXPOSE 9000 \ No newline at end of file +EXPOSE 9000 diff --git a/docker/configurations/supervisord.conf b/docker/configurations/supervisord.conf index 21978f78..ed240dbe 100644 --- a/docker/configurations/supervisord.conf +++ b/docker/configurations/supervisord.conf @@ -19,7 +19,7 @@ command=/usr/sbin/caddy run -c /etc/caddy/Caddyfile autostart=true autorestart=true redirect_stderr=true -stdout_logfile=/var/log/caddy/access.log +stdout_logfile=/dev/stdout stdout_logfile_maxbytes = 0 [program:php-fpm] @@ -27,5 +27,5 @@ command=/usr/local/sbin/php-fpm --nodaemonize autostart=true autorestart=true redirect_stderr=true -stdout_logfile=/var/log/php-fpm/access.log -stdout_logfile_maxbytes = 0 \ No newline at end of file +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes = 0