Skip to content

Deprecation log handling in TYPO3 9

The deprecation log is a handy feature of TYPO3 to learn what parts of your setup will not work anymore in future releases of TYPO3. In the recent version 9 there are important changes to the deprecation log and its handling.


This article has been superseded with our update on this matter:
Deprecation log handling - recent changes for TYPO3 9 and 10


It is a very convenient feature for integrators and developers of TYPO3. The deprecation log tells the whole truth about functionality being used, which will eventually vanish in the next version of TYPO3.

Since its introduction over more than 9 years ago, the deprecation log feature of the TYPO3 core has been a dedicated API using its own configuration option.

$GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog'] is the most important and well-known configuration option up to version 8 to control the behaviour of the deprecation log.

While there was no better means to handle deprecations back in the old days, things have luckily changed significantly in the PHP world as well as within TYPO3.

Technical details

With version 9 it was finally possible to let the dedicated deprecation log functionality be marked as deprecated itself. [1]

The new implementation of the deprecation log now uses the native PHP functionality to signal "user deprecations". This provides the Core and potential implementations of ErrorHandlers in extensions, to handle deprecations in a custom manner like any other PHP warning or error.

The current implementation in TYPO3 core applies a special treatment of those user deprecations as well and passes them on to the general logging infrastructure.

Configuration

Having deprecation log messages in the usual logging flow allows to leverage the full power of TYPO3's logging API. Specifically the numerous configuration options are handy to control where these log messages should end up at the end of the day (or better the request). [2]

By default, the Core sends all deprecation log messages to a dedicated log file in the typo3temp/var/logs folder. This is yet another advantage over the old location of the deprecation log file, which was formerly written to the typo3conf folder.

Of course there is always a small caveat with such big changes: The old well-known configuration option does not have any effect anymore.

The remaining question therefore is: How do I disable the deprecation log in TYPO3 9 LTS for production?

Luckily this is still a single line of configuration you can place in your ext_localconf.php of your sitesetup extension

$GLOBALS['TYPO3_CONF_VARS']['LOG']['TYPO3']['CMS']['deprecations']['writerConfiguration'][\TYPO3\CMS\Core\Log\LogLevel::NOTICE] = [];

This information applies to TYPO3 9 LTS.

[1] https://docs.typo3.org/typo3cms/extensions/core/latest/Changelog/9.0/Deprecation-82438-DeprecationMethods.html
[2] https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Logging/Configuration/Index.html#writer-configuration