[FOLLOWUP][!!!][TASK] Replace GeneralUtility::sysLog() with Logging API 61/54161/2
authorMarkus Klein <markus.klein@typo3.org>
Mon, 18 Sep 2017 08:41:36 +0000 (10:41 +0200)
committerHelmut Hummel <typo3@helhum.io>
Mon, 18 Sep 2017 12:25:11 +0000 (14:25 +0200)
Do not reference the logger inside a constructor as its injection
happens after the constructor has been executed.
Therefore create a dedicated instance for logging.

Resolves: #82430
Releases: master
Change-Id: Ic943ad53e4ae2abed3fabb55e24b17362de92e1c
Reviewed-on: https://review.typo3.org/54161
Reviewed-by: Alexander Schnitzler <review.typo3.org@alexanderschnitzler.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Tested-by: Alexander Schnitzler <review.typo3.org@alexanderschnitzler.de>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Tested-by: Helmut Hummel <typo3@helhum.io>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index aec8c13..d7243ce 100644 (file)
@@ -35,6 +35,7 @@ use TYPO3\CMS\Core\Localization\LocalizationFactory;
 use TYPO3\CMS\Core\Locking\Exception\LockAcquireWouldBlockException;
 use TYPO3\CMS\Core\Locking\LockFactory;
 use TYPO3\CMS\Core\Locking\LockingStrategyInterface;
+use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Resource\StorageRepository;
 use TYPO3\CMS\Core\Service\DependencyOrderingService;
@@ -816,7 +817,8 @@ class TypoScriptFrontendController implements LoggerAwareInterface
                 $warning = '&no_cache=1 has been supplied, so caching is disabled! URL: "' . GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL') . '"';
                 $this->disableCache();
             }
-            $this->logger->warning($warning);
+            // note: we need to instantiate the logger manually here since the injection happens after the constructor
+            GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__)->warning($warning);
         }
         $this->cHash = $cHash;
         $this->MP = $GLOBALS['TYPO3_CONF_VARS']['FE']['enable_mount_pids'] ? (string)$MP : '';