[BUGFIX] Fix scheduler task logging in case of an exception 86/52286/3
authorChristian Wolff <chris@connye.com>
Fri, 31 Mar 2017 07:23:49 +0000 (09:23 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Fri, 31 Mar 2017 11:11:03 +0000 (13:11 +0200)
Correctly log the message if a Scheduler task throws an exception.
The exception code is now part of the logged message too.

Resolves: #80566
Releases: master, 7.6
Change-Id: Ic4eb25608094869733b4a23057d209fab1a1bccf
Reviewed-on: https://review.typo3.org/52286
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Tested-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/scheduler/Classes/Task/AbstractTask.php

index 36d8b91..3fc1bb7 100644 (file)
@@ -490,8 +490,9 @@ abstract class AbstractTask
             }
             if ($failure instanceof \Exception) {
                 // Log failed execution
-                $logMessage = 'Task failed to execute successfully. Class: ' . get_class($this) . ', UID: ' . $this->taskUid . '. ' . $failure->getMessage();
-                $this->scheduler->log($logMessage, 1, $failure->getCode());
+                $logMessage = 'Task failed to execute successfully. Class: ' . get_class($this)
+                    . ', UID: ' . $this->taskUid . ', Code: ' . $failure->getCode() . ', ' . $failure->getMessage();
+                $this->scheduler->log($logMessage, 1);
                 // Do not serialize the complete exception or the trace, this can lead to huge strings > 50MB
                 $failureString = serialize([
                     'code' => $failure->getCode(),