[!!!][TASK] Deprecate GeneralUtility::devLog() 59/24559/29
authorMarkus Klein <markus.klein@typo3.org>
Sun, 10 Sep 2017 01:15:09 +0000 (03:15 +0200)
committerBenni Mack <benni@typo3.org>
Sat, 23 Sep 2017 11:50:57 +0000 (13:50 +0200)
The core now directly logs to the Logging API.

Resolves: #52694
Releases: master
Change-Id: Ia3c8f1c3608aff540a990e9078132b233bbedde6
Reviewed-on: https://review.typo3.org/24559
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
33 files changed:
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/core/Classes/Authentication/AbstractAuthenticationService.php
typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php
typo3/sysext/core/Classes/Authentication/AuthenticationService.php
typo3/sysext/core/Classes/Error/AbstractExceptionHandler.php
typo3/sysext/core/Classes/Error/ErrorHandler.php
typo3/sysext/core/Classes/Html/RteHtmlParser.php
typo3/sysext/core/Classes/Resource/ProcessedFileRepository.php
typo3/sysext/core/Classes/Resource/ResourceStorage.php
typo3/sysext/core/Classes/Service/AbstractService.php
typo3/sysext/core/Classes/Type/File/ImageInfo.php
typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml
typo3/sysext/core/Documentation/Changelog/master/Breaking-52694-GeneralUtilitydevLogNotCalledAnymore.rst [new file with mode: 0644]
typo3/sysext/core/Documentation/Changelog/master/Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
typo3/sysext/extbase/Classes/Object/Container/Container.php
typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php
typo3/sysext/extbase/Tests/Unit/Object/Container/ContainerTest.php
typo3/sysext/extensionmanager/Classes/Controller/UpdateScriptController.php
typo3/sysext/frontend/Classes/Authentication/FrontendUserAuthentication.php
typo3/sysext/frontend/Classes/ContentObject/Exception/ProductionExceptionHandler.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Http/RequestHandler.php
typo3/sysext/frontend/Classes/Resource/FileCollector.php
typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassConstantMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php
typo3/sysext/rsaauth/Classes/RsaAuthService.php
typo3/sysext/saltedpasswords/Classes/SaltedPasswordService.php
typo3/sysext/scheduler/Classes/Example/TestTask.php

index 3ae2f66..edf7f50 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Backend\Template;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Log\LoggerAwareInterface;
+use Psr\Log\LoggerAwareTrait;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
@@ -36,8 +38,10 @@ use TYPO3\CMS\Core\Utility\PathUtility;
  *
  * Please refer to Inside TYPO3 for a discussion of how to use this API.
  */
-class DocumentTemplate
+class DocumentTemplate implements LoggerAwareInterface
 {
+    use LoggerAwareTrait;
+
     // Vars you typically might want to/should set from outside after making instance of this class:
     /**
      * This can be set to the HTML-code for a formtag.
@@ -552,7 +556,7 @@ function jumpToUrl(URL) {
 </div>' : '') . $this->endOfPageJsBlock;
 
         // Logging: Can't find better place to put it:
-        GeneralUtility::devLog('END of BACKEND session', \TYPO3\CMS\Backend\Template\DocumentTemplate::class, 0, ['_FLUSH' => true]);
+        $this->logger->debug('END of BACKEND session', ['_FLUSH' => true]);
         return $str;
     }
 
index daa7059..55ef657 100644 (file)
@@ -71,7 +71,9 @@ class AbstractAuthenticationService extends AbstractService
     public $writeAttemptLog = false;
 
     /**
-     * If the \TYPO3\CMS\Core\Utility\GeneralUtility::devLog() function should be used
+     * Write additional log entries
+     *
+     * Specifically useful during development of authentication services
      *
      * @var bool
      */
index ab814d8..3aa361c 100644 (file)
@@ -328,7 +328,10 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
     public $svConfig = [];
 
     /**
-     * Write messages to the devlog
+     * Write additional log entries
+     *
+     * Specifically useful during development of authentication services
+     *
      * @var bool
      */
     public $writeDevLog = false;
@@ -388,7 +391,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
             $this->writeDevLog = true;
         }
         if ($this->writeDevLog) {
-            GeneralUtility::devLog('## Beginning of auth logging.', self::class);
+            $this->logger->debug('## Beginning of auth logging.');
         }
         // Init vars.
         $mode = '';
@@ -495,7 +498,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
             }
             if ($this->writeDevLog) {
                 $devLogMessage = ($isRefreshTimeBasedCookie ? 'Updated Cookie: ' : 'Set Cookie: ') . $this->id;
-                GeneralUtility::devLog($devLogMessage . ($cookieDomain ? ', ' . $cookieDomain : ''), self::class);
+                $this->logger->debug($devLogMessage . ($cookieDomain ? ', ' . $cookieDomain : ''));
             }
         }
     }
@@ -582,14 +585,14 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
         // Indicates if an active authentication failed (not auto login)
         $this->loginFailure = false;
         if ($this->writeDevLog) {
-            GeneralUtility::devLog('Login type: ' . $this->loginType, self::class);
+            $this->logger->debug('Login type: ' . $this->loginType);
         }
         // The info array provide additional information for auth services
         $authInfo = $this->getAuthInfoArray();
         // Get Login/Logout data submitted by a form or params
         $loginData = $this->getLoginFormData();
         if ($this->writeDevLog) {
-            GeneralUtility::devLog('Login data: ' . GeneralUtility::arrayToLogString($loginData), self::class);
+            $this->logger->debug('Login data', $loginData);
         }
         // Active logout (eg. with "logout" button)
         if ($loginData['status'] === 'logout') {
@@ -597,10 +600,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
                 // $type,$action,$error,$details_nr,$details,$data,$tablename,$recuid,$recpid
                 $this->writelog(255, 2, 0, 2, 'User %s logged out', [$this->user['username']], '', 0, 0);
             }
-            // Logout written to log
-            if ($this->writeDevLog) {
-                GeneralUtility::devLog('User logged out. Id: ' . $this->id, self::class, -1);
-            }
+            $this->logger->info('User logged out. Id: ' . $this->id);
             $this->logoff();
         }
         // Determine whether we need to skip session update.
@@ -621,7 +621,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
         if (!$haveSession && $loginData['status'] === 'login') {
             $activeLogin = true;
             if ($this->writeDevLog) {
-                GeneralUtility::devLog('Active login (eg. with login form)', self::class);
+                $this->logger->debug('Active login (eg. with login form)');
             }
             // check referrer for submitted login values
             if ($this->formfield_status && $loginData['uident'] && $loginData['uname']) {
@@ -648,12 +648,15 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
 
         if ($this->writeDevLog) {
             if ($haveSession) {
-                GeneralUtility::devLog('User session found: ' . GeneralUtility::arrayToLogString($authInfo['userSession'], [$this->userid_column, $this->username_column]), self::class, 0);
+                $this->logger->debug('User session found', [
+                    $this->userid_column => $authInfo['userSession'][$this->userid_column],
+                    $this->username_column => $authInfo['userSession'][$this->username_column],
+                ]);
             } else {
-                GeneralUtility::devLog('No user session found.', self::class, 2);
+                $this->logger->debug('No user session found');
             }
             if (is_array($this->svConfig['setup'])) {
-                GeneralUtility::devLog('SV setup: ' . GeneralUtility::arrayToLogString($this->svConfig['setup']), self::class, 0);
+                $this->logger->debug('SV setup', $this->svConfig['setup']);
             }
         }
 
@@ -669,7 +672,10 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
                 if ($row = $serviceObj->getUser()) {
                     $tempuserArr[] = $row;
                     if ($this->writeDevLog) {
-                        GeneralUtility::devLog('User found: ' . GeneralUtility::arrayToLogString($row, [$this->userid_column, $this->username_column]), self::class, 0);
+                        $this->logger->debug('User found', [
+                            $this->userid_column => $row[$this->userid_column],
+                            $this->username_column => $row[$this->username_column],
+                        ]);
                     }
                     // User found, just stop to search for more if not configured to go on
                     if (!$this->svConfig['setup'][$this->loginType . '_fetchAllUsers']) {
@@ -679,13 +685,13 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
             }
 
             if ($this->writeDevLog && $this->svConfig['setup'][$this->loginType . '_alwaysFetchUser']) {
-                GeneralUtility::devLog($this->loginType . '_alwaysFetchUser option is enabled', self::class);
+                $this->logger->debug($this->loginType . '_alwaysFetchUser option is enabled');
             }
             if ($this->writeDevLog && empty($tempuserArr)) {
-                GeneralUtility::devLog('No user found by services', self::class);
+                $this->logger->debug('No user found by services');
             }
             if ($this->writeDevLog && !empty($tempuserArr)) {
-                GeneralUtility::devLog(count($tempuserArr) . ' user records found by services', self::class);
+                $this->logger->debug(count($tempuserArr) . ' user records found by services');
             }
         }
 
@@ -696,14 +702,17 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
             // User is authenticated because we found a user session
             $authenticated = true;
             if ($this->writeDevLog) {
-                GeneralUtility::devLog('User session used: ' . GeneralUtility::arrayToLogString($authInfo['userSession'], [$this->userid_column, $this->username_column]), self::class);
+                $this->logger->debug('User session used', [
+                    $this->userid_column => $authInfo['userSession'][$this->userid_column],
+                    $this->username_column => $authInfo['userSession'][$this->username_column],
+                ]);
             }
         }
         // Re-auth user when 'auth'-service option is set
         if ($this->svConfig['setup'][$this->loginType . '_alwaysAuthUser']) {
             $authenticated = false;
             if ($this->writeDevLog) {
-                GeneralUtility::devLog('alwaysAuthUser option is enabled', self::class);
+                $this->logger->debug('alwaysAuthUser option is enabled');
             }
         }
         // Authenticate the user if needed
@@ -713,7 +722,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
                 // If one service returns FALSE then authentication failed
                 // a service might return 100 which means there's no reason to stop but the user can't be authenticated by that service
                 if ($this->writeDevLog) {
-                    GeneralUtility::devLog('Auth user: ' . GeneralUtility::arrayToLogString($tempuser), self::class);
+                    $this->logger->debug('Auth user', $tempuser);
                 }
                 $subType = 'authUser' . $this->loginType;
 
@@ -764,7 +773,10 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
                 // The login session is started.
                 $this->loginSessionStarted = true;
                 if ($this->writeDevLog && is_array($this->user)) {
-                    GeneralUtility::devLog('User session finally read: ' . GeneralUtility::arrayToLogString($this->user, [$this->userid_column, $this->username_column]), self::class, -1);
+                    $this->logger->debug('User session finally read', [
+                        $this->userid_column => $this->user[$this->userid_column],
+                        $this->username_column => $this->user[$this->username_column],
+                    ]);
                 }
             } elseif ($haveSession) {
                 // if we come here the current session is for sure not anonymous as this is a pre-condition for $authenticated = true
@@ -779,11 +791,11 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
             if ($this->writeStdLog && $activeLogin) {
                 $this->writelog(255, 1, 0, 1, 'User %s logged in from %s (%s)', [$tempuser[$this->username_column], GeneralUtility::getIndpEnv('REMOTE_ADDR'), GeneralUtility::getIndpEnv('REMOTE_HOST')], '', '', '');
             }
-            if ($this->writeDevLog && $activeLogin) {
-                GeneralUtility::devLog('User ' . $tempuser[$this->username_column] . ' logged in from ' . GeneralUtility::getIndpEnv('REMOTE_ADDR') . ' (' . GeneralUtility::getIndpEnv('REMOTE_HOST') . ')', self::class, -1);
+            if ($activeLogin) {
+                $this->logger->info('User ' . $tempuser[$this->username_column] . ' logged in from ' . GeneralUtility::getIndpEnv('REMOTE_ADDR') . ' (' . GeneralUtility::getIndpEnv('REMOTE_HOST') . ')');
             }
-            if ($this->writeDevLog && !$activeLogin) {
-                GeneralUtility::devLog('User ' . $tempuser[$this->username_column] . ' authenticated from ' . GeneralUtility::getIndpEnv('REMOTE_ADDR') . ' (' . GeneralUtility::getIndpEnv('REMOTE_HOST') . ')', self::class, -1);
+            if (!$activeLogin) {
+                $this->logger->debug('User ' . $tempuser[$this->username_column] . ' authenticated from ' . GeneralUtility::getIndpEnv('REMOTE_ADDR') . ' (' . GeneralUtility::getIndpEnv('REMOTE_HOST') . ')');
             }
         } else {
             // User was not authenticated, so we should reuse the existing anonymous session
@@ -794,11 +806,18 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
             // Mark the current login attempt as failed
             if ($activeLogin || !empty($tempuserArr)) {
                 $this->loginFailure = true;
-                if ($this->writeDevLog && empty($tempuserArr) && $activeLogin) {
-                    GeneralUtility::devLog('Login failed: ' . GeneralUtility::arrayToLogString($loginData), self::class, 2);
+                if (empty($tempuserArr) && $activeLogin) {
+                    $logData = [
+                        'loginData' => $loginData
+                    ];
+                    $this->logger->warning('Login failed', $logData);
                 }
-                if ($this->writeDevLog && !empty($tempuserArr)) {
-                    GeneralUtility::devLog('Login failed: ' . GeneralUtility::arrayToLogString($tempuser, [$this->userid_column, $this->username_column]), self::class, 2);
+                if (!empty($tempuserArr)) {
+                    $logData = [
+                        $this->userid_column => $tempuser[$this->userid_column],
+                        $this->username_column => $tempuser[$this->username_column],
+                    ];
+                    $this->logger->warning('Login failed', $logData);
                 }
             }
         }
@@ -806,7 +825,14 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
         // If there were a login failure, check to see if a warning email should be sent:
         if ($this->loginFailure && $activeLogin) {
             if ($this->writeDevLog) {
-                GeneralUtility::devLog('Call checkLogFailures: ' . GeneralUtility::arrayToLogString(['warningEmail' => $this->warningEmail, 'warningPeriod' => $this->warningPeriod, 'warningMax' => $this->warningMax]), self::class, -1);
+                $this->logger->debug(
+                    'Call checkLogFailures',
+                    [
+                        'warningEmail' => $this->warningEmail,
+                        'warningPeriod' => $this->warningPeriod,
+                        'warningMax' => $this->warningMax
+                    ]
+                );
             }
 
             // Hook to implement login failure tracking methods
@@ -854,7 +880,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
             yield $serviceObj;
         }
         if ($this->writeDevLog && $serviceChain) {
-            GeneralUtility::devLog($subType . ' auth services called: ' . $serviceChain, self::class);
+            $this->logger->debug($subType . ' auth services called: ' . $serviceChain);
         }
     }
 
@@ -899,7 +925,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
     public function createUserSession($tempuser)
     {
         if ($this->writeDevLog) {
-            GeneralUtility::devLog('Create session ses_id = ' . $this->id, self::class);
+            $this->logger->debug('Create session ses_id = ' . $this->id);
         }
         // Delete any session entry first
         $this->getSessionBackend()->remove($this->id);
@@ -960,7 +986,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
     public function fetchUserSession($skipSessionUpdate = false)
     {
         if ($this->writeDevLog) {
-            GeneralUtility::devLog('Fetch session ses_id = ' . $this->id, self::class);
+            $this->logger->debug('Fetch session ses_id = ' . $this->id);
         }
         try {
             $sessionRecord = $this->getSessionBackend()->get($this->id);
@@ -1019,7 +1045,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
     public function logoff()
     {
         if ($this->writeDevLog) {
-            GeneralUtility::devLog('logoff: ses_id = ' . $this->id, self::class);
+            $this->logger->debug('logoff: ses_id = ' . $this->id);
         }
         // Release the locked records
         BackendUtility::lockRecords();
@@ -1175,10 +1201,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
                 $variable = $this->uc;
             }
             if ($this->writeDevLog) {
-                GeneralUtility::devLog(
-                    'writeUC: ' . $this->userid_column . '=' . (int)$this->user[$this->userid_column],
-                    self::class
-                );
+                $this->logger->debug('writeUC: ' . $this->userid_column . '=' . (int)$this->user[$this->userid_column]);
             }
             GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($this->user_table)->update(
                 $this->user_table,
@@ -1277,7 +1300,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
         $this->sessionData[$key] = $data;
         $this->user['ses_data'] = serialize($this->sessionData);
         if ($this->writeDevLog) {
-            GeneralUtility::devLog('setAndSaveSessionData: ses_id = ' . $this->id, self::class);
+            $this->logger->debug('setAndSaveSessionData: ses_id = ' . $this->id);
         }
         $updatedSession = $this->getSessionBackend()->update(
             $this->id,
@@ -1330,7 +1353,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
         $loginSecurityLevel = trim($GLOBALS['TYPO3_CONF_VARS'][$this->loginType]['loginSecurityLevel']) ?: 'normal';
         $passwordTransmissionStrategy = $passwordTransmissionStrategy ?: $loginSecurityLevel;
         if ($this->writeDevLog) {
-            GeneralUtility::devLog('Login data before processing: ' . GeneralUtility::arrayToLogString($loginData), self::class);
+            $this->logger->debug('Login data before processing', $loginData);
         }
         $serviceChain = '';
         $subType = 'processLoginData' . $this->loginType;
@@ -1354,7 +1377,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
         if ($isLoginDataProcessed) {
             $loginData = $processedLoginData;
             if ($this->writeDevLog) {
-                GeneralUtility::devLog('Processed login data: ' . GeneralUtility::arrayToLogString($processedLoginData), self::class);
+                $this->logger->debug('Processed login data', $processedLoginData);
             }
         }
         return $loginData;
index 2eadf12..3bea763 100644 (file)
@@ -65,10 +65,16 @@ class AuthenticationService extends AbstractAuthenticationService
         if (!is_array($user)) {
             // Failed login attempt (no username found)
             $this->writelog(255, 3, 3, 2, 'Login-attempt from %s (%s), username \'%s\' not found!!', [$this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']]);
-            $this->logger->warning(sprintf('Login-attempt from %s (%s), username \'%s\' not found!', $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']));
+            $this->logger->info('Login-attempt from username \'' . $this->login['uname'] . '\' not found!', [
+                'REMOTE_ADDR' => $this->authInfo['REMOTE_ADDR'],
+                'REMOTE_HOST' => $this->authInfo['REMOTE_HOST'],
+            ]);
         } else {
             if ($this->writeDevLog) {
-                GeneralUtility::devLog('User found: ' . GeneralUtility::arrayToLogString($user, [$this->db_user['userid_column'], $this->db_user['username_column']]), self::class);
+                $this->logger->debug('User found', [
+                    $this->db_user['userid_column'] => $user[$this->db_user['userid_column']],
+                    $this->db_user['username_column'] => $user[$this->db_user['username_column']]
+                ]);
             }
         }
         return $user;
@@ -99,10 +105,13 @@ class AuthenticationService extends AbstractAuthenticationService
                 // Failed login attempt (wrong password) - write that to the log!
                 if ($this->writeAttemptLog) {
                     $this->writelog(255, 3, 3, 1, 'Login-attempt from %s (%s), username \'%s\', password not accepted!', [$this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']]);
-                    $this->logger->warning(sprintf('Login-attempt from %s (%s), username \'%s\', password not accepted!', $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname']));
+                    $this->logger->info('Login-attempt username \'' . $this->login['uname'] . '\', password not accepted!', [
+                        'REMOTE_ADDR' => $this->authInfo['REMOTE_ADDR'],
+                        'REMOTE_HOST' => $this->authInfo['REMOTE_HOST'],
+                    ]);
                 }
                 if ($this->writeDevLog) {
-                    GeneralUtility::devLog('Password not accepted: ' . $this->login['uident'], self::class, 2);
+                    $this->logger->debug('Password not accepted: ' . $this->login['uident']);
                 }
             }
             // Checking the domain (lockToDomain)
@@ -110,7 +119,12 @@ class AuthenticationService extends AbstractAuthenticationService
                 // Lock domain didn't match, so error:
                 if ($this->writeAttemptLog) {
                     $this->writelog(255, 3, 3, 1, 'Login-attempt from %s (%s), username \'%s\', locked domain \'%s\' did not match \'%s\'!', [$this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $user[$this->db_user['username_column']], $user['lockToDomain'], $this->authInfo['HTTP_HOST']]);
-                    $this->logger->warning(sprintf('Login-attempt from %s (%s), username \'%s\', locked domain \'%s\' did not match \'%s\'!', $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $user[$this->db_user['username_column']], $user['lockToDomain'], $this->authInfo['HTTP_HOST']));
+                    $this->logger->info('Login-attempt from username \'' . $user[$this->db_user['username_column']] . '\', locked domain did not match!', [
+                        'HTTP_HOST' => $this->authInfo['HTTP_HOST'],
+                        'REMOTE_ADDR' => $this->authInfo['REMOTE_ADDR'],
+                        'REMOTE_HOST' => $this->authInfo['REMOTE_HOST'],
+                        'lockToDomain' => $user['lockToDomain'],
+                    ]);
                 }
                 $OK = 0;
             }
@@ -151,7 +165,7 @@ class AuthenticationService extends AbstractAuthenticationService
             $groups = array_unique($groups);
             if (!empty($groups)) {
                 if ($this->writeDevLog) {
-                    GeneralUtility::devLog('Get usergroups with id: ' . implode(',', $groups), __CLASS__);
+                    $this->logger->debug('Get usergroups with id: ' . implode(',', $groups));
                 }
                 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
                     ->getQueryBuilderForTable($this->db_groups['table']);
@@ -185,7 +199,7 @@ class AuthenticationService extends AbstractAuthenticationService
                 }
             } else {
                 if ($this->writeDevLog) {
-                    GeneralUtility::devLog('No usergroups found.', self::class, 2);
+                    $this->logger->debug('No usergroups found.');
                 }
             }
         }
index e5f2b6f..d145f7d 100644 (file)
@@ -55,7 +55,6 @@ abstract class AbstractExceptionHandler implements ExceptionHandlerInterface, Si
      *
      * @param \Throwable $exception The throwable object.
      * @param string $context The context where the exception was thrown, WEB or CLI
-     * @see \TYPO3\CMS\Core\Utility\GeneralUtility::devLog()
      */
     protected function writeLogEntries(\Throwable $exception, $context)
     {
@@ -71,16 +70,13 @@ abstract class AbstractExceptionHandler implements ExceptionHandlerInterface, Si
         if ($context === 'WEB') {
             $logMessage .= '. Requested URL: ' . GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL');
         }
-        $backtrace = $exception->getTrace();
-        $this->logger->critical($logTitle . ': ' . $logMessage, ['exception' => $exception]);
         // When database credentials are wrong, the exception is probably
         // caused by this. Therefor we cannot do any database operation,
         // otherwise this will lead into recurring exceptions.
         try {
-            // Write error message to devlog
-            GeneralUtility::devLog($logMessage, $logTitle, 3, [
+            $this->logger->critical($logTitle . ': ' . $logMessage, [
                 'TYPO3_MODE' => TYPO3_MODE,
-                'backtrace' => $backtrace
+                'exception' => $exception
             ]);
             // Write error message to sys_log table
             $this->writeLog($logTitle . ': ' . $logMessage);
index 2bd87a3..5403077 100644 (file)
@@ -127,8 +127,6 @@ class ErrorHandler implements ErrorHandlerInterface, LoggerAwareInterface
         $message = $logTitle . ': ' . $message;
 
         $this->logger->log(LogLevel::NOTICE - $severity, $message);
-        // Write error message to devlog extension(s),
-        GeneralUtility::devLog($message, 'core', $severity + 1);
 
         // Write error message to TSlog (admin panel)
         $timeTracker = $this->getTimeTracker();
index 05201f8..d461e44 100644 (file)
@@ -14,10 +14,11 @@ namespace TYPO3\CMS\Core\Html;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Log\LoggerAwareInterface;
+use Psr\Log\LoggerAwareTrait;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\LinkHandling\Exception\UnknownLinkHandlerException;
 use TYPO3\CMS\Core\LinkHandling\LinkService;
-use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Resource;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Frontend\Service\TypoLinkCodecService;
@@ -30,8 +31,10 @@ use TYPO3\CMS\Frontend\Service\TypoLinkCodecService;
  * line breaks to LFs internally, however when all transformations are done, all LFs are transformed to CRLFs.
  * This means: RteHtmlParser always returns CRLFs to be maximum compatible with all formats.
  */
-class RteHtmlParser extends HtmlParser
+class RteHtmlParser extends HtmlParser implements LoggerAwareInterface
 {
+    use LoggerAwareTrait;
+
     /**
      * List of elements that are not wrapped into a "p" tag while doing the transformation.
      * @var string
@@ -374,7 +377,7 @@ class RteHtmlParser extends HtmlParser
                         } catch (Resource\Exception\FileDoesNotExistException $fileDoesNotExistException) {
                             // Log the fact the file could not be retrieved.
                             $message = sprintf('Could not find file with uid "%s"', $attribArray['data-htmlarea-file-uid']);
-                            $this->getLogger()->error($message);
+                            $this->logger->error($message);
                         }
                     }
                     if ($originalImageFile instanceof Resource\File) {
@@ -1311,16 +1314,4 @@ class RteHtmlParser extends HtmlParser
         }
         return implode('', $blocks);
     }
-
-    /**
-     * Instantiates a logger
-     *
-     * @return \TYPO3\CMS\Core\Log\Logger
-     */
-    protected function getLogger()
-    {
-        /** @var $logManager LogManager */
-        $logManager = GeneralUtility::makeInstance(LogManager::class);
-        return $logManager->getLogger(static::class);
-    }
 }
index 9443c98..8e4afdb 100644 (file)
@@ -14,16 +14,19 @@ namespace TYPO3\CMS\Core\Resource;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Log\LoggerAwareInterface;
+use Psr\Log\LoggerAwareTrait;
 use TYPO3\CMS\Core\Database\ConnectionPool;
-use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Repository for accessing files
  * it also serves as the public API for the indexing part of files in general
  */
-class ProcessedFileRepository extends AbstractRepository
+class ProcessedFileRepository extends AbstractRepository implements LoggerAwareInterface
 {
+    use LoggerAwareTrait;
+
     /**
      * The main object type of this class. In some cases (fileReference) this
      * repository can also return FileReference objects, implementing the
@@ -261,7 +264,6 @@ class ProcessedFileRepository extends AbstractRepository
             )
             ->execute();
 
-        $logger = $this->getLogger();
         $errorCount = 0;
 
         while ($row = $result->fetch()) {
@@ -273,7 +275,7 @@ class ProcessedFileRepository extends AbstractRepository
                 $file->getStorage()->setEvaluatePermissions(false);
                 $file->delete(true);
             } catch (\Exception $e) {
-                $logger->error(
+                $this->logger->error(
                     'Failed to delete file "' . $row['identifier'] . '" in storage uid ' . $row['storage'] . '.',
                     [
                         'exception' => $e
@@ -309,12 +311,4 @@ class ProcessedFileRepository extends AbstractRepository
 
         return array_intersect_key($data, $this->tableColumns[$this->table]);
     }
-
-    /**
-     * @return \TYPO3\CMS\Core\Log\Logger
-     */
-    protected function getLogger()
-    {
-        return GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
-    }
 }
index d08ac76..2beb1f7 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Core\Resource;
  */
 
 use TYPO3\CMS\Core\Database\ConnectionPool;
+use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Registry;
 use TYPO3\CMS\Core\Resource\Exception\ExistingTargetFileNameException;
 use TYPO3\CMS\Core\Resource\Exception\InvalidTargetFolderException;
@@ -190,7 +191,8 @@ class ResourceStorage implements ResourceStorageInterface
                 $e->getMessage()
             );
 
-            $this->getLogger()->error($message);
+            // create a dedicated logger instance because we need a logger in the constructor
+            GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class)->error($message);
         }
         $this->driver->initialize();
         $this->capabilities = $this->driver->getCapabilities();
@@ -3011,16 +3013,4 @@ class ResourceStorage implements ResourceStorageInterface
     {
         return $GLOBALS['BE_USER'];
     }
-
-    /**
-     * @return \TYPO3\CMS\Core\Log\Logger
-     */
-    protected function getLogger()
-    {
-        /** @var $logManager \TYPO3\CMS\Core\Log\LogManager */
-        $logManager = GeneralUtility::makeInstance(
-            \TYPO3\CMS\Core\Log\LogManager::class
-        );
-        return $logManager->getLogger(static::class);
-    }
 }
index a03934f..c10eb0d 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Service;
  *
  * The TYPO3 project - inspiring people to share!
  */
+
 use Psr\Log\LoggerAwareInterface;
 use Psr\Log\LoggerAwareTrait;
 use TYPO3\CMS\Core\TimeTracker\TimeTracker;
@@ -38,7 +39,11 @@ abstract class AbstractService implements LoggerAwareInterface
     public $error = [];
 
     /**
-     * @var bool Defines if debug messages should be written with \TYPO3\CMS\Core\Utility\GeneralUtility::devLog
+     * Write additional log entries
+     *
+     * Specifically useful during development of authentication services
+     *
+     * @var bool
      */
     public $writeDevLog = false;
 
@@ -149,16 +154,19 @@ abstract class AbstractService implements LoggerAwareInterface
      *
      ***************************************/
     /**
-     * Logs debug messages to \TYPO3\CMS\Core\Utility\GeneralUtility::devLog()
+     * Logs debug messages to the Logging API
      *
      * @param string $msg Debug message
      * @param int $severity Severity: 0 is info, 1 is notice, 2 is warning, 3 is fatal error, -1 is "OK" message
-     * @param array|bool $dataVar dditional data you want to pass to the logger.
+     * @param array|bool $dataVar additional data you want to pass to the logger.
+     * @deprecated since TYPO3 CMS 9, will be removed in TYPO3 CMS 10.
      */
     public function devLog($msg, $severity = 0, $dataVar = false)
     {
+        GeneralUtility::logDeprecatedFunction();
         if ($this->writeDevLog) {
-            GeneralUtility::devLog($msg, $this->info['serviceKey'], $severity, $dataVar);
+            $message = $this->info['serviceKey'] . ': ' . $msg;
+            $this->logger->debug($message, (array)$dataVar);
         }
     }
 
index 7c6e5e6..e5072ee 100644 (file)
@@ -13,15 +13,18 @@ namespace TYPO3\CMS\Core\Type\File;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use Psr\Log\LoggerAwareInterface;
+use Psr\Log\LoggerAwareTrait;
 use TYPO3\CMS\Core\Imaging\GraphicalFunctions;
-use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * A SPL FileInfo class providing information related to an image.
  */
-class ImageInfo extends FileInfo
+class ImageInfo extends FileInfo implements LoggerAwareInterface
 {
+    use LoggerAwareTrait;
+
     /**
      * @var array
      */
@@ -69,7 +72,7 @@ class ImageInfo extends FileInfo
 
             // In case the image size could not be retrieved, log the incident as a warning.
             if (empty($this->imageSizes)) {
-                $this->getLogger()->warning('I could not retrieve the image size for file ' . $this->getPathname());
+                $this->logger->warning('I could not retrieve the image size for file ' . $this->getPathname());
                 $this->imageSizes = [0, 0];
             }
         }
@@ -106,17 +109,6 @@ class ImageInfo extends FileInfo
     }
 
     /**
-     * @return \TYPO3\CMS\Core\Log\Logger
-     */
-    protected function getLogger()
-    {
-        /** @var $loggerManager LogManager */
-        $loggerManager = GeneralUtility::makeInstance(LogManager::class);
-
-        return $loggerManager->getLogger(static::class);
-    }
-
-    /**
      * @return GraphicalFunctions
      */
     protected function getGraphicalFunctions()
index 8787970..0c443b6 100644 (file)
@@ -1095,7 +1095,6 @@ class TypoScriptParser
                     // If this is not a beginning commented include statement this line goes into the rest content
                     $restContent[] = $line;
                 }
-                //if (is_array($matches)) GeneralUtility::devLog('matches', 'TypoScriptParser', 0, $matches);
             } else {
                 // Inside commented include statements
                 // Search for the matching ending commented include statement
index c09a25d..d3d7031 100644 (file)
@@ -42,6 +42,7 @@ use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
 class GeneralUtility
 {
     // Severity constants used by \TYPO3\CMS\Core\Utility\GeneralUtility::devLog()
+    // @deprecated since TYPO3 CMS 9, will be removed in TYPO3 CMS 10.
     const SYSLOG_SEVERITY_INFO = 0;
     const SYSLOG_SEVERITY_NOTICE = 1;
     const SYSLOG_SEVERITY_WARNING = 2;
@@ -1761,10 +1762,10 @@ class GeneralUtility
                 } catch (\Exception $e) {
                     $errorMessage = 'Error minifying java script: ' . $e->getMessage();
                     $error .= $errorMessage;
-                    static::devLog($errorMessage, \TYPO3\CMS\Core\Utility\GeneralUtility::class, 2, [
+                    static::getLogger()->warning($errorMessage, [
                         'JavaScript' => $script,
-                        'Stack trace' => $e->getTrace(),
-                        'hook' => $hookMethod
+                        'hook' => $hookMethod,
+                        'exception' => $e,
                     ]);
                 }
             }
@@ -3866,9 +3867,11 @@ class GeneralUtility
      * @param string $extKey Extension key (from which extension you are calling the log)
      * @param int $severity Severity: 0 is info, 1 is notice, 2 is warning, 3 is fatal error, -1 is "OK" message
      * @param mixed $dataVar Additional data you want to pass to the logger.
+     * @deprecated since TYPO3 CMS 9, will be removed in TYPO3 CMS 10.
      */
     public static function devLog($msg, $extKey, $severity = 0, $dataVar = false)
     {
+        static::logDeprecatedFunction();
         if ((bool)$GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG'] && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['devLog'])) {
             $params = ['msg' => $msg, 'extKey' => $extKey, 'severity' => $severity, 'dataVar' => $dataVar];
             $fakeThis = false;
@@ -3906,10 +3909,6 @@ class GeneralUtility
                 self::fixPermissions($destination);
             }
         }
-        if (in_array('devlog', $log) !== false) {
-            // Copy message also to the developer log
-            self::devLog($msg, 'Core', self::SYSLOG_SEVERITY_WARNING);
-        }
         // Do not use console in login screen
         if (in_array('console', $log) !== false && isset($GLOBALS['BE_USER']->user['uid'])) {
             DebugUtility::debug($msg, $date, 'Deprecation Log');
index 2c8eacc..0bfe8bd 100644 (file)
@@ -107,7 +107,7 @@ SYS:
             description: 'Defines a list of IP addresses which will allow development-output to display. The debug() function will use this as a filter. See the function <code>\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP()</code> for details on syntax. Setting this to blank value will deny all. Setting to "*" will allow all.'
         enable_DLOG:
             type: bool
-            description: 'Whether the developer log is enabled.'
+            description: 'Whether the developer log is enabled. This option has been deprecated in favor of the Logging API, and will be removed in TYPO3 v10. Do not depend on it.'
         ddmmyy:
             type: text
             description: 'Format of Date-Month-Year - see PHP-function <a href="http://php.net/date" target="_blank">date()</a>'
@@ -158,7 +158,7 @@ SYS:
             description: 'Enable the severity of log messages to be logged (see systemLog option) - Only messages with same or higher severity are logged.'
         enableDeprecationLog:
             type: list
-            description: 'If set, this configuration enables the logging of deprecated methods and functions. The following options are allowed: <dl><dt>String: &quot;file&quot; (or integer &quot;1&quot;)</dt><dd>The log file will be written to typo3conf/deprecation_[hash-value].log</dd><dt>String: &quot;devlog&quot;</dt><dd>The log will be written to the development log</dd><dt>String: &quot;console&quot;<dt><dd>The log will be displayed in the Backend''s Debug Console.</dd></dl>Logging options &quot;file&quot;, &quot;devlog&quot; and &quot;console&quot; can be combined by comma-separating them.'
+            description: 'If set, this configuration enables the logging of deprecated methods and functions. The following options are allowed: <dl><dt>String: &quot;file&quot; (or integer &quot;1&quot;)</dt><dd>The log file will be written to typo3conf/deprecation_[hash-value].log</dd><dt>String: &quot;console&quot;<dt><dd>The log will be displayed in the Backend''s Debug Console.</dd></dl>Logging options &quot;file&quot; and &quot;console&quot; can be combined by comma-separating them.'
         UTF8filesystem:
             type: bool
             description: 'If TRUE then TYPO3 uses utf-8 to store file names. This allows for accented Latin letters as well as any other non-latin characters like Cyrillic and Chinese.'
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-52694-GeneralUtilitydevLogNotCalledAnymore.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-52694-GeneralUtilitydevLogNotCalledAnymore.rst
new file mode 100644 (file)
index 0000000..596bd0e
--- /dev/null
@@ -0,0 +1,29 @@
+.. include:: ../../Includes.txt
+
+==============================================================
+Breaking: #52694 - GeneralUtility::devLog() not called anymore
+==============================================================
+
+See :issue:`52694`
+
+Description
+===========
+
+:php:`TYPO3\CMS\Core\Utility\GeneralUtility::devLog()` is deprecated. Therefore the Core does not call this function
+anymore. Instead the Logging API is used to write log data.
+
+The option to write the deprecation log to the devLog has been removed.
+
+Impact
+======
+
+Log data can be filtered through the writer configuration for the Logging API.
+Registered devLog extensions are not triggered anymore by the Core.
+
+
+Migration
+=========
+
+Add a custom writer configuration to retrieve devLog entries. These are mostly of level Info and Notice.
+
+.. index:: PHP-API, NotScanned
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst
new file mode 100644 (file)
index 0000000..805f109
--- /dev/null
@@ -0,0 +1,21 @@
+.. include:: ../../Includes.txt
+
+=========================================================
+Deprecation: #52694 - Deprecated GeneralUtility::devLog()
+=========================================================
+
+See :issue:`52694`
+
+Description
+===========
+
+The PHP method :php:`TYPO3\CMS\Core\Utility\GeneralUtility::devLog()` has been deprecated in favour of the Logging API.
+
+Additionally these PHP symbols have been deprecated as well:
+
+- :php:`TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_*` constants
+- :php:`TYPO3\CMS\Core\Service\AbstractService::devLog()`
+- :php:`$GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']`
+- :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['devLog']`
+
+.. index:: LocalConfiguration, PHP-API, NotScanned
index bb61408..18118e2 100644 (file)
@@ -2498,18 +2498,6 @@ class GeneralUtilityTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $this->assertSame($testString, GeneralUtility::minifyJavaScript($testString));
     }
 
-    /**
-     * Callback function used in
-     * minifyJavaScriptReturnsErrorStringOfHookException and
-     * minifyJavaScriptWritesExceptionMessageToDevLog
-     *
-     * @throws \RuntimeException
-     */
-    public function minifyJavaScriptErroneousCallback()
-    {
-        throw new \RuntimeException('foo', 1344888548);
-    }
-
     ///////////////////////////////
     // Tests concerning fixPermissions
     ///////////////////////////////
index e4d2d39..179b78a 100644 (file)
@@ -14,6 +14,10 @@ namespace TYPO3\CMS\Extbase\Object\Container;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Log\LoggerInterface;
+use TYPO3\CMS\Core\Log\LogManager;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Internal TYPO3 Dependency Injection container
  */
@@ -81,7 +85,7 @@ class Container implements \TYPO3\CMS\Core\SingletonInterface
     protected function getClassInfoFactory()
     {
         if ($this->classInfoFactory == null) {
-            $this->classInfoFactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\ClassInfoFactory::class);
+            $this->classInfoFactory = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\ClassInfoFactory::class);
         }
         return $this->classInfoFactory;
     }
@@ -94,7 +98,7 @@ class Container implements \TYPO3\CMS\Core\SingletonInterface
     protected function getClassInfoCache()
     {
         if ($this->cache == null) {
-            $this->cache = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\ClassInfoCache::class);
+            $this->cache = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\ClassInfoCache::class);
         }
         return $this->cache;
     }
@@ -158,10 +162,10 @@ class Container implements \TYPO3\CMS\Core\SingletonInterface
             return $this;
         }
         if ($className === \TYPO3\CMS\Core\Cache\CacheManager::class) {
-            return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class);
+            return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class);
         }
         if ($className === \TYPO3\CMS\Core\Package\PackageManager::class) {
-            return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Package\PackageManager::class);
+            return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Package\PackageManager::class);
         }
         $className = \TYPO3\CMS\Core\Core\ClassLoadingInformation::getClassNameForAlias($className);
         if (isset($this->singletonInstances[$className])) {
@@ -206,7 +210,7 @@ class Container implements \TYPO3\CMS\Core\SingletonInterface
         }
         $constructorArguments = $this->getConstructorArguments($className, $classInfo, $givenConstructorArguments);
         array_unshift($constructorArguments, $className);
-        $instance = call_user_func_array([\TYPO3\CMS\Core\Utility\GeneralUtility::class, 'makeInstance'], $constructorArguments);
+        $instance = call_user_func_array([GeneralUtility::class, 'makeInstance'], $constructorArguments);
         if ($classIsSingleton) {
             $this->singletonInstances[$className] = $instance;
         }
@@ -227,7 +231,7 @@ class Container implements \TYPO3\CMS\Core\SingletonInterface
         foreach ($classInfo->getInjectMethods() as $injectMethodName => $classNameToInject) {
             $instanceToInject = $this->getInstanceInternal($classNameToInject);
             if ($classInfo->getIsSingleton() && !$instanceToInject instanceof \TYPO3\CMS\Core\SingletonInterface) {
-                $this->log('The singleton "' . $classInfo->getClassName() . '" needs a prototype in "' . $injectMethodName . '". This is often a bad code smell; often you rather want to inject a singleton.', 1);
+                $this->getLogger()->notice('The singleton "' . $classInfo->getClassName() . '" needs a prototype in "' . $injectMethodName . '". This is often a bad code smell; often you rather want to inject a singleton.');
             }
             if (is_callable([$instance, $injectMethodName])) {
                 $instance->{$injectMethodName}($instanceToInject);
@@ -236,9 +240,9 @@ class Container implements \TYPO3\CMS\Core\SingletonInterface
         foreach ($classInfo->getInjectProperties() as $injectPropertyName => $classNameToInject) {
             $instanceToInject = $this->getInstanceInternal($classNameToInject);
             if ($classInfo->getIsSingleton() && !$instanceToInject instanceof \TYPO3\CMS\Core\SingletonInterface) {
-                $this->log('The singleton "' . $classInfo->getClassName() . '" needs a prototype in "' . $injectPropertyName . '". This is often a bad code smell; often you rather want to inject a singleton.', 1);
+                $this->getLogger()->notice('The singleton "' . $classInfo->getClassName() . '" needs a prototype in "' . $injectPropertyName . '". This is often a bad code smell; often you rather want to inject a singleton.');
             }
-            $propertyReflection = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Reflection\PropertyReflection::class, $instance, $injectPropertyName);
+            $propertyReflection = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Reflection\PropertyReflection::class, $instance, $injectPropertyName);
 
             $propertyReflection->setAccessible(true);
             $propertyReflection->setValue($instance, $instanceToInject);
@@ -259,17 +263,6 @@ class Container implements \TYPO3\CMS\Core\SingletonInterface
     }
 
     /**
-     * Wrapper for dev log, in order to ease testing
-     *
-     * @param string $message Message (in english).
-     * @param int $severity Severity: 0 is info, 1 is notice, 2 is warning, 3 is fatal error, -1 is "OK" message
-     */
-    protected function log($message, $severity)
-    {
-        \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($message, 'extbase', $severity);
-    }
-
-    /**
      * register a classname that should be used if a dependency is required.
      * e.g. used to define default class for an interface
      *
@@ -302,7 +295,7 @@ class Container implements \TYPO3\CMS\Core\SingletonInterface
                 if (isset($argumentInformation['dependency']) && !array_key_exists('defaultValue', $argumentInformation)) {
                     $parameter = $this->getInstanceInternal($argumentInformation['dependency']);
                     if ($classInfo->getIsSingleton() && !$parameter instanceof \TYPO3\CMS\Core\SingletonInterface) {
-                        $this->log('The singleton "' . $className . '" needs a prototype in the constructor. This is often a bad code smell; often you rather want to inject a singleton.', 1);
+                        $this->getLogger()->notice('The singleton "' . $className . '" needs a prototype in the constructor. This is often a bad code smell; often you rather want to inject a singleton.');
                     }
                 } elseif (array_key_exists('defaultValue', $argumentInformation)) {
                     $parameter = $argumentInformation['defaultValue'];
@@ -369,4 +362,12 @@ class Container implements \TYPO3\CMS\Core\SingletonInterface
     {
         return !$this->isSingleton($className);
     }
+
+    /**
+     * @return LoggerInterface
+     */
+    protected function getLogger()
+    {
+        return GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
+    }
 }
index 222f049..7a9960a 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Extbase\Validation;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Utility\ClassNamingUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Utility\TypeHandlingUtility;
@@ -115,7 +116,7 @@ class ValidatorResolver implements \TYPO3\CMS\Core\SingletonInterface
 
             return $validator;
         } catch (NoSuchValidatorException $e) {
-            GeneralUtility::devLog($e->getMessage(), 'extbase', GeneralUtility::SYSLOG_SEVERITY_INFO);
+            GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__)->debug($e->getMessage());
             return null;
         }
     }
index d033642..144a761 100644 (file)
@@ -13,6 +13,8 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Object\Container;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use Psr\Log\LoggerInterface;
+use TYPO3\CMS\Core\Log\Logger;
 use TYPO3\CMS\Extbase\Object\Exception;
 use TYPO3\CMS\Extbase\Object\Exception\CannotBuildObjectException;
 
@@ -27,6 +29,11 @@ class ContainerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     protected $container;
 
     /**
+     * @var LoggerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $logger;
+
+    /**
      * @var \TYPO3\CMS\Extbase\Object\Container\ClassInfo
      */
     protected $cachedClassInfo;
@@ -39,10 +46,17 @@ class ContainerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
             ->getMock();
         $mockedCache->expects($this->any())->method('get')->will($this->returnValue(false));
         $mockedCache->expects($this->never())->method('has');
+
+        $this->logger = $this->getMockBuilder(Logger::class)
+            ->setMethods(['notice'])
+            ->disableOriginalConstructor()
+            ->getMock();
+
         $this->container = $this->getMockBuilder(\TYPO3\CMS\Extbase\Object\Container\Container::class)
-            ->setMethods(['log', 'getClassInfoCache'])
+            ->setMethods(['getLogger', 'getClassInfoCache'])
             ->getMock();
         $this->container->expects($this->any())->method('getClassInfoCache')->will($this->returnValue($mockedCache));
+        $this->container->expects($this->any())->method('getLogger')->will($this->returnValue($this->logger));
     }
 
     /**
@@ -290,7 +304,7 @@ class ContainerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function singletonWhichRequiresPrototypeViaSetterInjectionWorksAndAddsDebugMessage()
     {
-        $this->container->expects($this->once())->method('log')->with('The singleton "t3lib_object_singletonNeedsPrototype" needs a prototype in "injectDependency". This is often a bad code smell; often you rather want to inject a singleton.', 1);
+        $this->logger->expects($this->once())->method('notice')->with('The singleton "t3lib_object_singletonNeedsPrototype" needs a prototype in "injectDependency". This is often a bad code smell; often you rather want to inject a singleton.');
         $object = $this->container->getInstance('t3lib_object_singletonNeedsPrototype');
         $this->assertInstanceOf('t3lib_object_prototype', $object->dependency);
     }
@@ -300,7 +314,7 @@ class ContainerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function singletonWhichRequiresSingletonViaSetterInjectionWorks()
     {
-        $this->container->expects($this->never())->method('log');
+        $this->logger->expects($this->never())->method('notice');
         $object = $this->container->getInstance('t3lib_object_singletonNeedsSingleton');
         $this->assertInstanceOf('t3lib_object_singleton', $object->dependency);
     }
@@ -310,7 +324,7 @@ class ContainerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function prototypeWhichRequiresPrototypeViaSetterInjectionWorks()
     {
-        $this->container->expects($this->never())->method('log');
+        $this->logger->expects($this->never())->method('notice');
         $object = $this->container->getInstance('t3lib_object_prototypeNeedsPrototype');
         $this->assertInstanceOf('t3lib_object_prototype', $object->dependency);
     }
@@ -320,7 +334,7 @@ class ContainerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function prototypeWhichRequiresSingletonViaSetterInjectionWorks()
     {
-        $this->container->expects($this->never())->method('log');
+        $this->logger->expects($this->never())->method('notice');
         $object = $this->container->getInstance('t3lib_object_prototypeNeedsSingleton');
         $this->assertInstanceOf('t3lib_object_singleton', $object->dependency);
     }
@@ -330,7 +344,7 @@ class ContainerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function singletonWhichRequiresPrototypeViaConstructorInjectionWorksAndAddsDebugMessage()
     {
-        $this->container->expects($this->once())->method('log')->with('The singleton "t3lib_object_singletonNeedsPrototypeInConstructor" needs a prototype in the constructor. This is often a bad code smell; often you rather want to inject a singleton.', 1);
+        $this->logger->expects($this->once())->method('notice')->with('The singleton "t3lib_object_singletonNeedsPrototypeInConstructor" needs a prototype in the constructor. This is often a bad code smell; often you rather want to inject a singleton.');
         $object = $this->container->getInstance('t3lib_object_singletonNeedsPrototypeInConstructor');
         $this->assertInstanceOf('t3lib_object_prototype', $object->dependency);
     }
@@ -340,7 +354,7 @@ class ContainerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function singletonWhichRequiresSingletonViaConstructorInjectionWorks()
     {
-        $this->container->expects($this->never())->method('log');
+        $this->logger->expects($this->never())->method('notice');
         $object = $this->container->getInstance('t3lib_object_singletonNeedsSingletonInConstructor');
         $this->assertInstanceOf('t3lib_object_singleton', $object->dependency);
     }
@@ -350,7 +364,7 @@ class ContainerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function prototypeWhichRequiresPrototypeViaConstructorInjectionWorks()
     {
-        $this->container->expects($this->never())->method('log');
+        $this->logger->expects($this->never())->method('notice');
         $object = $this->container->getInstance('t3lib_object_prototypeNeedsPrototypeInConstructor');
         $this->assertInstanceOf('t3lib_object_prototype', $object->dependency);
     }
@@ -360,7 +374,7 @@ class ContainerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function prototypeWhichRequiresSingletonViaConstructorInjectionWorks()
     {
-        $this->container->expects($this->never())->method('log');
+        $this->logger->expects($this->never())->method('notice');
         $object = $this->container->getInstance('t3lib_object_prototypeNeedsSingletonInConstructor');
         $this->assertInstanceOf('t3lib_object_singleton', $object->dependency);
     }
index 992b40b..9c93828 100644 (file)
@@ -46,8 +46,6 @@ class UpdateScriptController extends AbstractModuleController
      */
     public function showAction($extensionKey)
     {
-        \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Request for update script', 'extensionmanager', 0, $extensionKey);
-
         /** @var $updateScriptUtility \TYPO3\CMS\Extensionmanager\Utility\UpdateScriptUtility */
         $updateScriptUtility = $this->objectManager->get(\TYPO3\CMS\Extensionmanager\Utility\UpdateScriptUtility::class);
         $updateScriptResult = $updateScriptUtility->executeUpdateIfNeeded($extensionKey);
index fd6fc5b..11b98a7 100644 (file)
@@ -280,9 +280,12 @@ class FrontendUserAuthentication extends AbstractUserAuthentication
         $authInfo = $this->getAuthInfoArray();
         if ($this->writeDevLog) {
             if (is_array($this->user)) {
-                GeneralUtility::devLog('Get usergroups for user: ' . GeneralUtility::arrayToLogString($this->user, [$this->userid_column, $this->username_column]), __CLASS__);
+                $this->logger->debug('Get usergroups for user', [
+                    $this->userid_column => $this->user[$this->userid_column],
+                    $this->username_column => $this->user[$this->username_column]
+                ]);
             } else {
-                GeneralUtility::devLog('Get usergroups for "anonymous" user', __CLASS__);
+                $this->logger->debug('Get usergroups for "anonymous" user');
             }
         }
         $groupDataArr = [];
@@ -299,14 +302,16 @@ class FrontendUserAuthentication extends AbstractUserAuthentication
             }
             unset($serviceObj);
         }
-        if ($this->writeDevLog && $serviceChain) {
-            GeneralUtility::devLog($subType . ' auth services called: ' . $serviceChain, __CLASS__);
-        }
-        if ($this->writeDevLog && empty($groupDataArr)) {
-            GeneralUtility::devLog('No usergroups found by services', __CLASS__);
-        }
-        if ($this->writeDevLog && !empty($groupDataArr)) {
-            GeneralUtility::devLog(count($groupDataArr) . ' usergroup records found by services', __CLASS__);
+        if ($this->writeDevLog) {
+            if ($serviceChain) {
+                $this->logger->debug($subType . ' auth services called: ' . $serviceChain);
+            }
+            if (empty($groupDataArr)) {
+                $this->logger->debug('No usergroups found by services');
+            }
+            if (!empty($groupDataArr)) {
+                $this->logger->debug(count($groupDataArr) . ' usergroup records found by services');
+            }
         }
         // Use 'auth' service to check the usergroups if they are really valid
         foreach ($groupDataArr as $groupData) {
@@ -320,7 +325,10 @@ class FrontendUserAuthentication extends AbstractUserAuthentication
                 if (!$serviceObj->authGroup($this->user, $groupData)) {
                     $validGroup = false;
                     if ($this->writeDevLog) {
-                        GeneralUtility::devLog($subType . ' auth service did not auth group: ' . GeneralUtility::arrayToLogString($groupData, 'uid,title'), __CLASS__, 2);
+                        $this->logger->debug($subType . ' auth service did not auth group', [
+                            'uid ' => $groupData['uid'],
+                            'title' => $groupData['title']
+                        ]);
                     }
                     break;
                 }
index 18636a2..f1853b6 100644 (file)
@@ -14,17 +14,19 @@ namespace TYPO3\CMS\Frontend\ContentObject\Exception;
  * The TYPO3 project - inspiring people to share!
  */
 
-use Psr\Log\LoggerInterface;
+use Psr\Log\LoggerAwareInterface;
+use Psr\Log\LoggerAwareTrait;
 use TYPO3\CMS\Core\Crypto\Random;
-use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Frontend\ContentObject\AbstractContentObject;
 
 /**
  * Exception handler class for content object rendering
  */
-class ProductionExceptionHandler implements ExceptionHandlerInterface
+class ProductionExceptionHandler implements ExceptionHandlerInterface, LoggerAwareInterface
 {
+    use LoggerAwareTrait;
+
     /**
      * @var array
      */
@@ -71,14 +73,6 @@ class ProductionExceptionHandler implements ExceptionHandlerInterface
      */
     protected function logException(\Exception $exception, $errorMessage, $code)
     {
-        $this->getLogger()->alert(sprintf($errorMessage, $code), ['exception' => $exception]);
-    }
-
-    /**
-     * @return LoggerInterface
-     */
-    protected function getLogger()
-    {
-        return GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
+        $this->logger->alert(sprintf($errorMessage, $code), ['exception' => $exception]);
     }
 }
index d7243ce..6c5acf1 100644 (file)
@@ -1021,7 +1021,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
             $this->gr_list .= ',' . implode(',', $gr_array);
         }
         if ($this->fe_user->writeDevLog) {
-            GeneralUtility::devLog('Valid usergroups for TSFE: ' . $this->gr_list, __CLASS__);
+            $this->logger->debug('Valid usergroups for TSFE: ' . $this->gr_list);
         }
     }
 
index 58c4051..cb87a6d 100644 (file)
@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\FrontendBackendUserAuthentication;
 use TYPO3\CMS\Core\Core\Bootstrap;
 use TYPO3\CMS\Core\FrontendEditing\FrontendEditingController;
 use TYPO3\CMS\Core\Http\RequestHandlerInterface;
+use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\TimeTracker\TimeTracker;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
@@ -265,7 +266,8 @@ class RequestHandler implements RequestHandlerInterface
         if ($sendTSFEContent) {
             $response->getBody()->write($this->controller->content);
         }
-        GeneralUtility::devLog('END of FRONTEND session', 'cms', 0, ['_FLUSH' => true]);
+        GeneralUtility::makeInstance(LogManager::class)
+                      ->getLogger(get_class())->debug('END of FRONTEND session', ['_FLUSH' => true]);
         return $response;
     }
 
index 5876b25..0e5667a 100644 (file)
@@ -14,7 +14,8 @@ namespace TYPO3\CMS\Frontend\Resource;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Core\Log\LogManager;
+use Psr\Log\LoggerAwareInterface;
+use Psr\Log\LoggerAwareTrait;
 use TYPO3\CMS\Core\Resource\Exception;
 use TYPO3\CMS\Core\Resource\FileCollectionRepository;
 use TYPO3\CMS\Core\Resource\FileInterface;
@@ -31,8 +32,10 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
  *
  * Is not persisted, use only in FE.
  */
-class FileCollector implements \Countable
+class FileCollector implements \Countable, LoggerAwareInterface
 {
+    use LoggerAwareTrait;
+
     /**
      * The files
      *
@@ -73,7 +76,7 @@ class FileCollector implements \Countable
                 try {
                     $this->addFileObject($this->getResourceFactory()->getFileObject($fileUid));
                 } catch (Exception $e) {
-                    $this->getLogger()->warning(
+                    $this->logger->warning(
                         'The file with uid  "' . $fileUid
                         . '" could not be found and won\'t be included in frontend output',
                         ['exception' => $e]
@@ -146,7 +149,7 @@ class FileCollector implements \Countable
                     $this->addFileObjects($files);
                 }
             } catch (Exception $e) {
-                $this->getLogger()->warning(
+                $this->logger->warning(
                     'The file-collection with uid  "' . $fileCollectionUid
                     . '" could not be found or contents could not be loaded and won\'t be included in frontend output.',
                     ['exception' => $e]
@@ -184,7 +187,7 @@ class FileCollector implements \Countable
                     $this->addFileObjects(array_values($files));
                 }
             } catch (Exception $e) {
-                $this->getLogger()->warning(
+                $this->logger->warning(
                     'The folder with identifier  "' . $folderIdentifier
                     . '" could not be found and won\'t be included in frontend output',
                     ['exception' => $e]
@@ -267,14 +270,6 @@ class FileCollector implements \Countable
     }
 
     /**
-     * @return \TYPO3\CMS\Core\Log\Logger
-     */
-    protected function getLogger()
-    {
-        return GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
-    }
-
-    /**
      * @return ResourceFactory
      */
     protected function getResourceFactory()
index ca1aeeb..68c5f21 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Frontend\Tests\Unit\Authentication;
 
 use Doctrine\DBAL\Statement;
 use Prophecy\Argument;
+use Psr\Log\NullLogger;
 use TYPO3\CMS\Core\Authentication\AuthenticationService;
 use TYPO3\CMS\Core\Crypto\Random;
 use TYPO3\CMS\Core\Database\ConnectionPool;
@@ -96,6 +97,7 @@ class FrontendUserAuthenticationTest extends UnitTestCase
         $sessionManagerProphecy->getSessionBackend('FE')->willReturn($sessionBackendProphecy->reveal());
 
         $subject = new FrontendUserAuthentication();
+        $subject->setLogger(new NullLogger());
         $subject->gc_probability = -1;
         $subject->start();
 
@@ -136,6 +138,7 @@ class FrontendUserAuthenticationTest extends UnitTestCase
         $sessionBackendProphecy->update(Argument::cetera())->shouldNotBeCalled();
 
         $subject = new FrontendUserAuthentication();
+        $subject->setLogger(new NullLogger());
         $subject->gc_probability = -1;
         $subject->start();
         $subject->storeSessionData();
@@ -183,6 +186,7 @@ class FrontendUserAuthenticationTest extends UnitTestCase
         $sessionBackendProphecy->remove($uniqueSessionId)->shouldBeCalled();
 
         $subject = new FrontendUserAuthentication();
+        $subject->setLogger(new NullLogger());
         $subject->gc_probability = -1;
         $subject->start();
         $subject->setSessionData('foo', 'bar');
@@ -243,6 +247,7 @@ class FrontendUserAuthenticationTest extends UnitTestCase
         )->shouldBeCalled();
 
         $subject = new FrontendUserAuthentication();
+        $subject->setLogger(new NullLogger());
         $subject->gc_probability = -1;
         $subject->start();
         $this->assertEmpty($subject->getSessionData($uniqueSessionId));
@@ -324,6 +329,7 @@ class FrontendUserAuthenticationTest extends UnitTestCase
         );
 
         $subject = new FrontendUserAuthentication();
+        $subject->setLogger(new NullLogger());
         $subject->gc_probability = -1;
         $subject->start();
 
@@ -371,6 +377,7 @@ class FrontendUserAuthenticationTest extends UnitTestCase
                 'getCookie',
             ])
             ->getMock();
+        $subject->setLogger(new NullLogger());
         $subject->gc_probability = -1;
 
         // Mock a login attempt
index 25b49e2..507e3de 100644 (file)
@@ -49,6 +49,11 @@ return [
             'Breaking-82421-DroppedOldDBRelatedConfigurationOptions.rst',
         ],
     ],
+    '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SYS\'][\'enable_DLOG\']' => [
+        'restFiles' => [
+            'Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst',
+        ],
+    ],
 
     // Hooks
     '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'t3lib/class.t3lib_befunc.php\'][\'getFlexFormDSClass\']' => [
@@ -89,4 +94,9 @@ return [
             'Breaking-82377-OptionToAllowUploadingSystemExtensionsRemoved.rst',
         ],
     ],
+    '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'t3lib/class.t3lib_div.php\'][\'devLog\']' => [
+        'restFiles' => [
+            'Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst',
+        ],
+    ],
 ];
index 79cdaa9..597251e 100644 (file)
@@ -30,4 +30,29 @@ return [
             'Breaking-82378-RemoveNamespacedJQuery.rst',
         ],
     ],
+    'TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_INFO' => [
+        'restFiles' => [
+            'Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst',
+        ],
+    ],
+    'TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_NOTICE' => [
+        'restFiles' => [
+            'Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst',
+        ],
+    ],
+    'TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_WARNING' => [
+        'restFiles' => [
+            'Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst',
+        ],
+    ],
+    'TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR' => [
+        'restFiles' => [
+            'Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst',
+        ],
+    ],
+    'TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_FATAL' => [
+        'restFiles' => [
+            'Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst',
+        ],
+    ],
 ];
index 4a88de3..ef82d39 100644 (file)
@@ -1226,11 +1226,18 @@ return [
             'Breaking-82398-RemoveSpecialConstantTSConstantEditor.rst',
         ],
     ],
-    '\TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository->findByPidsAndAuthor' => [
+    'TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository->findByPidsAndAuthor' => [
         'numberOfMandatoryArguments' => 2,
         'maximumNumberOfArguments' => 2,
         'restFiles' => [
             'Deprecation-82506-RemoveBackendUserRepositoryInjectionInNoteController.rst',
         ],
     ],
+    'TYPO3\CMS\Core\Service\AbstractService->devLog' => [
+        'numberOfMandatoryArguments' => 1,
+        'maximumNumberOfArguments' => 3,
+        'restFiles' => [
+            'Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst',
+        ],
+    ],
 ];
index 5a2b08a..3a6a2dd 100644 (file)
@@ -67,12 +67,12 @@ class RsaAuthService extends AuthenticationService
                     $isProcessed = true;
                 } else {
                     if ($this->pObj->writeDevLog) {
-                        GeneralUtility::devLog('Process login data: Failed to RSA decrypt password', self::class);
+                        $this->logger->debug('Process login data: Failed to RSA decrypt password');
                     }
                 }
             } else {
                 if ($this->pObj->writeDevLog) {
-                    GeneralUtility::devLog('Process login data: passwordTransmissionStrategy has been set to "rsa" but no rsa encrypted password has been found.', self::class);
+                    $this->logger->debug('Process login data: passwordTransmissionStrategy has been set to "rsa" but no rsa encrypted password has been found.');
                 }
             }
         }
index dd24f88..60f44fd 100644 (file)
@@ -192,7 +192,7 @@ class SaltedPasswordService extends AbstractAuthenticationService
             } elseif ($validPasswd && $user['lockToDomain'] && strcasecmp($user['lockToDomain'], $this->authInfo['HTTP_HOST'])) {
                 // Lock domain didn't match, so error:
                 $errorMessage = 'Login-attempt from %s (%s), username \'%s\', locked domain \'%s\' did not match \'%s\'!';
-                $this->writeLogMessage($errorMessage, $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $this->login['uname'], $user['lockToDomain'], $this->authInfo['HTTP_HOST']);
+                $this->writeLogMessage($errorMessage, $this->authInfo['REMOTE_ADDR'], $this->authInfo['REMOTE_HOST'], $user[$this->db_user['username_column']], $user['lockToDomain'], $this->authInfo['HTTP_HOST']);
                 $this->writelog(255, 3, 3, 1, $errorMessage, [
                     $this->authInfo['REMOTE_ADDR'],
                     $this->authInfo['REMOTE_HOST'],
@@ -227,11 +227,7 @@ class SaltedPasswordService extends AbstractAuthenticationService
             ['uid' => (int)$uid]
         );
 
-        GeneralUtility::devLog(
-            sprintf('Automatic password update for user record in %s with uid %u', $this->pObj->user_table, $uid),
-            $this->extKey,
-            1
-        );
+        $this->logger->notice('Automatic password update for user record in ' . $this->pObj->user_table . ' with uid ' . $uid);
     }
 
     /**
@@ -251,13 +247,11 @@ class SaltedPasswordService extends AbstractAuthenticationService
         if (!empty($params)) {
             $message = vsprintf($message, $params);
         }
-        if (TYPO3_MODE === 'BE') {
-            $this->logger->notice($message);
-        } else {
+        if (TYPO3_MODE === 'FE') {
             /** @var TimeTracker $timeTracker */
             $timeTracker = GeneralUtility::makeInstance(TimeTracker::class);
             $timeTracker->setTSlogMessage($message);
         }
-        GeneralUtility::devLog($message, $this->extKey, GeneralUtility::SYSLOG_SEVERITY_NOTICE);
+        $this->logger->notice($message);
     }
 }
index 47cfe1d..0d3d025 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Scheduler\Example;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Provides testing procedures
  */
@@ -37,7 +39,7 @@ class TestTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask
         $success = false;
         if (!empty($this->email)) {
             // If an email address is defined, send a message to it
-            \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[TYPO3\\CMS\\Scheduler\\Example\\TestTask]: Test email sent to "' . $this->email . '"', 'scheduler', 0);
+            $this->logger->info('[TYPO3\\CMS\\Scheduler\\Example\\TestTask]: Test email sent to "' . $this->email . '"');
             // Get execution information
             $exec = $this->getExecution();
             // Get call method
@@ -46,7 +48,7 @@ class TestTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask
                 $site = '-';
             } else {
                 $calledBy = 'TYPO3 backend';
-                $site = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
+                $site = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
             }
             $start = $exec->getStart();
             $end = $exec->getEnd();
@@ -57,7 +59,7 @@ class TestTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask
             // Prepare mailer and send the mail
             try {
                 /** @var $mailer \TYPO3\CMS\Core\Mail\MailMessage */
-                $mailer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailMessage::class);
+                $mailer = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailMessage::class);
                 $mailer->setFrom([$this->email => 'SCHEDULER TEST-TASK']);
                 $mailer->setReplyTo([$this->email => 'SCHEDULER TEST-TASK']);
                 $mailer->setSubject('SCHEDULER TEST-TASK');
@@ -70,7 +72,7 @@ class TestTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask
             }
         } else {
             // No email defined, just log the task
-            \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[TYPO3\\CMS\\Scheduler\\Example\\TestTask]: No email address given', 'scheduler', 2);
+            $this->logger->warning('[TYPO3\\CMS\\Scheduler\\Example\\TestTask]: No email address given');
         }
         return $success;
     }