Skip to content

Commit 12f4a36

Browse files
committed
Remove deprecation logging by default and added env to reenable it again
The files can easily get quite large and probably also not good for performance. This fixes issue #1405
1 parent ef7e6d6 commit 12f4a36

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

.env

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ DISABLE_YEAR2038_BUG_CHECK=0
149149
#TRUSTED_PROXIES=127.0.0.0/8,::1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
150150
#TRUSTED_HOSTS='^(localhost|example\.com)$'
151151

152+
###################################################################################
153+
# Logging settings
154+
###################################################################################
155+
156+
# The minimum level a deprecation notice must have to be written to the var/log/<env>_deprecations.log file.
157+
# Deprecation notices are logged with level "info", so this disables the deprecation log by default.
158+
# Set to debug to log all deprecation notices
159+
DEPRECATION_LOG_LEVEL=emergency
160+
161+
152162

153163
###> symfony/lock ###
154164
# Choose one of the stores below

config/packages/monolog.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ when@prod:
5151
type: stream
5252
channels: [deprecation]
5353
path: "%kernel.logs_dir%/%kernel.environment%_deprecations.log"
54+
level: "%env(DEPRECATION_LOG_LEVEL)%"
5455

5556
when@docker:
5657
monolog:
@@ -75,3 +76,4 @@ when@docker:
7576
type: stream
7677
channels: [deprecation]
7778
path: "%kernel.logs_dir%/%kernel.environment%_deprecations.log"
79+
level: "%env(DEPRECATION_LOG_LEVEL)%"

docs/configuration.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,13 @@ See the [information providers]({% link usage/information_provider_system.md %})
279279
* `BANNER`: You can configure the text that should be shown as the banner on the homepage. Useful especially for docker
280280
containers. In all other applications you can just change the `config/banner.md` file.
281281
* `DISABLE_YEAR2038_BUG_CHECK` (env only): If set to `1`, the year 2038 bug check is disabled on 32-bit systems, and dates after
282-
2038 are no longer forbidden. However this will lead to 500 error messages when rendering dates after 2038 as all current
282+
2038 are no longer forbidden. However, this will lead to 500 error messages when rendering dates after 2038 as all current
283283
32-bit PHP versions can not format these dates correctly. This setting is for the case that future PHP versions will
284284
handle this correctly on 32-bit systems. 64-bit systems are not affected by this bug, and the check is always disabled.
285+
* `DEPRECATION_LOG_LEVEL` (default `emergency`) (env only): In the `prod` and `docker` environments, PHP/Symfony
286+
deprecation notices are written to their own `var/log/<env>_deprecations.log` file. This option sets the minimum log
287+
level a deprecation notice must have to be written there. Since deprecation notices are logged with level `info`,
288+
the default value of `emergency` effectively disables this dedicated deprecation log. Set it to `debug` to enable it.
285289

286290
## Banner
287291

0 commit comments

Comments
 (0)