diff --git a/typo3/sysext/core/Classes/Core/Bootstrap.php b/typo3/sysext/core/Classes/Core/Bootstrap.php index 32554cf564b6def0999a2bef98c86c71f9f10ffe..92f335e360ef69a1c8c528b0afef3a79b9982f7c 100644 --- a/typo3/sysext/core/Classes/Core/Bootstrap.php +++ b/typo3/sysext/core/Classes/Core/Bootstrap.php @@ -386,7 +386,7 @@ class Bootstrap $debugExceptionHandlerClassName = $GLOBALS['TYPO3_CONF_VARS']['SYS']['debugExceptionHandler']; $errorHandlerClassName = $GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandler']; - $errorHandlerErrors = $GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors']; + $errorHandlerErrors = $GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors'] | E_USER_DEPRECATED; $exceptionalErrors = $GLOBALS['TYPO3_CONF_VARS']['SYS']['exceptionalErrors']; $displayErrorsSetting = (int)$GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors']; diff --git a/typo3/sysext/core/Classes/Log/LogManager.php b/typo3/sysext/core/Classes/Log/LogManager.php index f605c6b5155e9b2176d01ba5a11572e7d96e3c79..03c21312707e3e54c22f422b3649addc0d1ec2e1 100644 --- a/typo3/sysext/core/Classes/Log/LogManager.php +++ b/typo3/sysext/core/Classes/Log/LogManager.php @@ -141,6 +141,10 @@ class LogManager implements SingletonInterface, LogManagerInterface $configuration = $this->getConfigurationForLogger(self::CONFIGURATION_TYPE_WRITER, $logger->getName()); foreach ($configuration as $severityLevel => $writer) { foreach ($writer as $logWriterClassName => $logWriterOptions) { + if ($logWriterOptions['disabled'] ?? false) { + continue; + } + unset($logWriterOptions['disabled']); try { /** @var \TYPO3\CMS\Core\Log\Writer\WriterInterface $logWriter */ $logWriter = GeneralUtility::makeInstance($logWriterClassName, $logWriterOptions); diff --git a/typo3/sysext/core/Configuration/DefaultConfiguration.php b/typo3/sysext/core/Configuration/DefaultConfiguration.php index d301c9b8a33f526eb9afc1549ec7673e889829b7..8c061002b5ee5e437b35490fac55a58df8daab68 100644 --- a/typo3/sysext/core/Configuration/DefaultConfiguration.php +++ b/typo3/sysext/core/Configuration/DefaultConfiguration.php @@ -1426,7 +1426,8 @@ return [ 'writerConfiguration' => [ \TYPO3\CMS\Core\Log\LogLevel::NOTICE => [ \TYPO3\CMS\Core\Log\Writer\FileWriter::class => [ - 'logFileInfix' => 'deprecations' + 'logFileInfix' => 'deprecations', + 'disabled' => true, ], ] ] diff --git a/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml b/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml index 1c02393713384ef30d6423c55b31af3761b6ae3d..98e60dca1f9b464fdab42de99365470dad23618e 100644 --- a/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml +++ b/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml @@ -181,7 +181,7 @@ SYS: description: 'Classname to handle PHP errors. E.g.: TYPO3\CMS\Core\Error\ErrorHandler. This class displays and logs all errors that are registered as [SYS][errorHandlerErrors]. Leave empty to disable error handling. Errors will be logged and can be sent to the optionally installed developer log or to the "syslog" database table. If an error is registered in [SYS][exceptionalErrors] it will be turned into an exception to be handled by the configured exceptionHandler.' errorHandlerErrors: type: errors - description: 'The E_* constant that will be handled by the [SYS][errorHandler]. Not all PHP error types can be handled! Default is 30466 = <code>E_ALL & ~(E_STRICT | E_NOTICE | E_COMPILE_WARNING | E_COMPILE_ERROR | E_CORE_WARNING | E_CORE_ERROR | E_PARSE | E_ERROR)</code> (see <a href="http://php.net/manual/en/errorfunc.constants.php" target="_blank" rel="noreferrer">PHP documentation</a>).' + description: 'The E_* constant that will be handled by the [SYS][errorHandler]. Not all PHP error types can be handled! <code>E_USER_DEPRECATED</code> will always be handled, regardless of this setting. Default is 30466 = <code>E_ALL & ~(E_STRICT | E_NOTICE | E_COMPILE_WARNING | E_COMPILE_ERROR | E_CORE_WARNING | E_CORE_ERROR | E_PARSE | E_ERROR)</code> (see <a href="http://php.net/manual/en/errorfunc.constants.php" target="_blank" rel="noreferrer">PHP documentation</a>).' exceptionalErrors: type: errors description: 'The E_* constant that will be converted into an exception by the default [SYS][errorHandler]. Default is 4096 = <code>E_ALL & ~(E_STRICT | E_NOTICE | E_COMPILE_WARNING | E_COMPILE_ERROR | E_CORE_WARNING | E_CORE_ERROR | E_PARSE | E_ERROR | E_DEPRECATED | E_USER_DEPRECATED | E_WARNING | E_USER_ERROR | E_USER_NOTICE | E_USER_WARNING)</code> (see <a href="http://php.net/manual/en/errorfunc.constants.php" target="_blank rel="noreferrer"">PHP documentation</a>). E_USER_DEPRECATED is always excluded to avoid exceptions to be thrown for deprecation messages.' diff --git a/typo3/sysext/core/Documentation/Changelog/9.5.x/Important-84105-StreamlineDeprecationLogHandling.rst b/typo3/sysext/core/Documentation/Changelog/9.5.x/Important-84105-StreamlineDeprecationLogHandling.rst new file mode 100644 index 0000000000000000000000000000000000000000..8306612de85da0facd2def2d264a9bdce412c204 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/9.5.x/Important-84105-StreamlineDeprecationLogHandling.rst @@ -0,0 +1,47 @@ +.. include:: ../../Includes.txt + +======================================================= +Important: #84105 - Streamline deprecation log handling +======================================================= + +See :issue:`84105` + +Description +=========== + +TYPO3 now comes with default configuration, in which deprecation logging is disabled. +This means if you update to the latest TYPO3 version, you need to change your development +configuration to enable deprecation logging in case you need it. + +Enabling the deprecation log can be done in Install Tool. Navigate to "Settings", +click on "Choose Preset" in "Configuration Presets" pane, open "Debug Settings", select "Debug" +and submit with "Activate preset". +Disabling deprecation log can be done by selecting the "Live" preset instead. + +Please note, that these steps only enable/disable the FileWriter, which comes with TYPO3 default configuration. +If you manually configured **additional** writers for the `TYPO3.CMS.deprecations` logger, you need to manually remove +them to completely disable deprecation logging. + +This is how the LOG section in :file:`LocalConfiguration.php` looks like with disabled deprecation logging: + +.. code-block:: php + + 'LOG' => [ + 'TYPO3' => [ + 'CMS' => [ + 'deprecations' => [ + 'writerConfiguration' => [ + \TYPO3\CMS\Core\Log\LogLevel::NOTICE => [ + \TYPO3\CMS\Core\Log\Writer\FileWriter::class => [ + 'disabled' => true, + ], + ], + ], + ], + ], + ], + ], + +Any other log writer can be disabled as well, by providing a `disabled` option with a truthy value. + +.. index:: LocalConfiguration, ext:core diff --git a/typo3/sysext/install/Classes/Configuration/Context/DebugPreset.php b/typo3/sysext/install/Classes/Configuration/Context/DebugPreset.php index c7141cf53a451ea99653dfb65885938b01fb8a1c..d703eba970ab889b9539ccb0e18c6f40e2947517 100644 --- a/typo3/sysext/install/Classes/Configuration/Context/DebugPreset.php +++ b/typo3/sysext/install/Classes/Configuration/Context/DebugPreset.php @@ -16,7 +16,8 @@ namespace TYPO3\CMS\Install\Configuration\Context; use TYPO3\CMS\Core\Core\Environment; -use TYPO3\CMS\Install\Configuration; +use TYPO3\CMS\Core\Log\LogLevel; +use TYPO3\CMS\Core\Log\Writer\FileWriter; use TYPO3\CMS\Install\Configuration\AbstractPreset; /** @@ -43,6 +44,8 @@ class DebugPreset extends AbstractPreset 'FE/debug' => true, 'SYS/devIPmask' => '*', 'SYS/displayErrors' => 1, + // Values below are not available in UI + 'LOG/TYPO3/CMS/deprecations/writerConfiguration/' . LogLevel::NOTICE . '/' . FileWriter::class . '/disabled' => false, // E_WARNING | E_RECOVERABLE_ERROR | E_DEPRECATED 'SYS/exceptionalErrors' => 12290, ]; diff --git a/typo3/sysext/install/Classes/Configuration/Context/LivePreset.php b/typo3/sysext/install/Classes/Configuration/Context/LivePreset.php index 840533f8f8165046ad0afe68991713c9bfc72457..85aa5fa5cf0922068ab53d522d3a679fb971779d 100644 --- a/typo3/sysext/install/Classes/Configuration/Context/LivePreset.php +++ b/typo3/sysext/install/Classes/Configuration/Context/LivePreset.php @@ -16,7 +16,8 @@ namespace TYPO3\CMS\Install\Configuration\Context; use TYPO3\CMS\Core\Core\Environment; -use TYPO3\CMS\Install\Configuration; +use TYPO3\CMS\Core\Log\LogLevel; +use TYPO3\CMS\Core\Log\Writer\FileWriter; use TYPO3\CMS\Install\Configuration\AbstractPreset; /** @@ -43,6 +44,8 @@ class LivePreset extends AbstractPreset 'FE/debug' => false, 'SYS/devIPmask' => '', 'SYS/displayErrors' => 0, + // Values below are not available in UI + 'LOG/TYPO3/CMS/deprecations/writerConfiguration/' . LogLevel::NOTICE . '/' . FileWriter::class . '/disabled' => true, // E_RECOVERABLE_ERROR 'SYS/exceptionalErrors' => 4096, ];