From 5be53ebf6c4eaa6c7a12fe45d4edd51071885a88 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 28 May 2025 15:08:13 +0200 Subject: [PATCH 1/2] [HttpKernel] Document that Monolog handles the creation of log folder --- logging.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/logging.rst b/logging.rst index 0ad36031dd5..bded9ab72a1 100644 --- a/logging.rst +++ b/logging.rst @@ -92,8 +92,14 @@ In the ``prod`` environment, logs are written to `STDERR PHP stream`_, which works best in modern containerized applications deployed to servers without disk write permissions. -If you prefer to store production logs in a file, set the ``path`` of your -log handler(s) to the path of the file to use (e.g. ``var/log/prod.log``). +If you prefer to store production logs in a file, set the ``path`` option of your +log handler(s) to the desired file path (e.g. ``var/log/prod.log``). This directory +is created by Monolog if needed, so Symfony applications running on read-only +filesystems don't need to create it manually or make it writable. + +.. versionadded:: 7.3 + + The feature to create the log directory automatically was introduced in Symfony 7.3. Handlers: Writing Logs to different Locations --------------------------------------------- From d78c7db6bac5faa9dbf9a969bd6e141af9b286e2 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 25 Jul 2025 11:21:09 +0200 Subject: [PATCH 2/2] Tweak --- logging.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/logging.rst b/logging.rst index bded9ab72a1..5f10226c30d 100644 --- a/logging.rst +++ b/logging.rst @@ -94,8 +94,9 @@ disk write permissions. If you prefer to store production logs in a file, set the ``path`` option of your log handler(s) to the desired file path (e.g. ``var/log/prod.log``). This directory -is created by Monolog if needed, so Symfony applications running on read-only -filesystems don't need to create it manually or make it writable. +is created by Monolog if it doesn't exist. If your Symfony application runs on a +read-only filesystem, set the path to an external writable directory (e.g. +``APP_LOG_DIR=/tmp/log``). .. versionadded:: 7.3