[TASK] Use a dedicated logger for E_USER_DEPRECATION 25/57125/5
authorMarkus Klein <markus.klein@typo3.org>
Mon, 4 Jun 2018 20:32:26 +0000 (22:32 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Thu, 19 Jul 2018 15:46:56 +0000 (17:46 +0200)
Resolves: #85238
Releases: master
Change-Id: Ie47e1ba0a4f0ba3e5e1a8d62bc137cabd3ae4d1e
Reviewed-on: https://review.typo3.org/57125
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Tested-by: Helmut Hummel <typo3@helhum.io>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/core/Classes/Error/ErrorHandler.php
typo3/sysext/core/Configuration/DefaultConfiguration.php

index 5435cf0..5c01ded 100644 (file)
@@ -18,6 +18,7 @@ use Psr\Log\LoggerAwareInterface;
 use Psr\Log\LoggerAwareTrait;
 use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Log\LogLevel;
+use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\TimeTracker\TimeTracker;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -132,6 +133,11 @@ class ErrorHandler implements ErrorHandlerInterface, LoggerAwareInterface
         $logTitle = 'Core: Error handler (' . TYPO3_MODE . ')';
         $message = $logTitle . ': ' . $message;
 
+        if ($errorLevel === E_USER_DEPRECATED) {
+            $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger('TYPO3.CMS.deprecations');
+            $logger->notice($message);
+            return true;
+        }
         if ($this->logger) {
             $this->logger->log(LogLevel::NOTICE - $severity, $message);
         }
index 4d25413..814678c 100644 (file)
@@ -1321,9 +1321,18 @@ return [
                             ]
                         ]
                     ]
+                ],
+                'deprecations' => [
+                    'writerConfiguration' => [
+                        \TYPO3\CMS\Core\Log\LogLevel::NOTICE => [
+                            \TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
+                                'logFileInfix' => 'deprecations'
+                            ],
+                        ]
+                    ]
                 ]
             ]
-        ]
+        ],
     ],
     'USER' => [],
     'SC_OPTIONS' => [ // Here you can more or less freely define additional configuration for scripts in TYPO3. Of course the features supported depends on the script. See documentation "Inside TYPO3" for examples. Keys in the array are the relative path of a script (for output scripts it should be the "script ID" as found in a comment in the HTML header ) and values can then be anything that scripts wants to define for itself. The key "GLOBAL" is reserved.