Issue Feature Closed

#100946Scheduler: More details via mail on failed task

Philipp Kitzberger 06/02/23, 08:56 updated 12/02/25, 14:33

Description

In the mail received on a failed scheduler task it would be helpful to have more information available that helps identifying the problematic task. Currently there’s only the stack trace but e.g. not the id of the scheduler task itself. Other informations might be helpful too.

Sure, the failed task is marked as failed in the BE, but that’s not a persistent information we can rely on. The subsequent run of that task might have ran smoothly again. And still I might wanna look into that one that failed.

Reviews 3

Files 3

History 1222

  1. Garvin Hicking commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2024-06-20T19:33:35+00:00" > 06/20/24, 19:33 </span>

    Might https://review.typo3.org/84152 be related and solved it for you?

  2. Philipp Kitzberger commented <span data-processor="relativetime" data-value="2024-06-27T07:47:36+00:00" > 06/27/24, 07:47 </span>

    @ghi, yes, that is kinda related, but not changing the contents of the cronjob MAILTO mail. I’d like to have ID and name of the failed scheduler task included in that mail.

  3. Garvin Hicking commented <span data-processor="relativetime" data-value="2024-06-27T14:27:23+00:00" > 06/27/24, 14:27 </span>

    Philipp Kitzberger wrote in #note-5:
    > @ghi, yes, that is kinda related, but not changing the contents of the cronjob MAILTO mail. I’d like to have ID and name of the failed scheduler task included in that mail.

    Do you have an example mail you get and how it looks with the patch above applied? I thought that the stdterr would contain the contents of the error logger, but this is not the case? I don’t have a setup where I could easily investigate this, do you happen to know an easy way to make a scheduler task fail and generate the output that is used for a MAILTO command?

  4. Philipp Kitzberger commented <span data-processor="relativetime" data-value="2024-07-11T11:50:09+00:00" > 07/11/24, 11:50 </span>

    Hm, simply add this to EXT:scheduler/Classes/Example/TestTask.php->execute():

    throw new \Exception('Boom!');

    Then add a task of that class to the scheduler and call it via:

    $ bin/typo3cms scheduler:run --task=1 --force
    
     [ERROR] Boom!                         

    That message is what’s been sent as mail content. Which is not exactly helpful at all.

    Your patch doesn’t change that. But I guess modifying SchedulerCommand.php would do the trick:

                    try {
                        $this->executeOrStopTask($task);
                    } catch (\Exception $e) {
                        $this->io->getErrorStyle()->error($e->getMessage());
                        ...

    Maybe just output a bit more than just the exceptions message. A 2nd line with scheduler id and title would already be an improvement.

  5. Garvin Hicking commented <span data-processor="relativetime" data-value="2024-07-11T19:19:04+00:00" > 07/11/24, 19:19 </span>

    Ah, I see – if Exceptions are involved that’s another thing.

    Your patch idea looks promising, would you like to implement/propose that as a core patch, or should I?!

  6. Gerrit Code Review pushed patch set 1 for main to change 87001 status Needs Feedback Under Review <span data-processor="relativetime" data-value="2024-11-16T10:34:20+00:00" > 11/16/24, 10:34 </span>

  7. Philipp Kitzberger commented and changed attached Bildschirmfoto vom 2024-11-18 10-37-21.png attached Bildschirmfoto vom 2024-11-18 10-40-19.png <span data-processor="relativetime" data-value="2024-11-18T09:40:47+00:00" > 11/18/24, 09:40 </span>

    This is how patch set 1 looks like on the CLI:

    Bildschirmfoto%20vom%202024-11-18%2010-37-21.png

    And in the mail client:

    Bildschirmfoto%20vom%202024-11-18%2010-40-19.png

  8. Philipp Kitzberger commented and changed attached Bildschirmfoto vom 2024-11-18 10-45-29.png <span data-processor="relativetime" data-value="2024-11-18T09:46:46+00:00" > 11/18/24, 09:46 </span>

    Rather like this?

    Bildschirmfoto%20vom%202024-11-18%2010-45-29.png

  9. Philipp Kitzberger commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2024-11-22T19:00:08+00:00" > 11/22/24, 19:00 </span>

    Applied in changeset commit:65f01b75a3853b7b46a4e9bb29fd75d7a4e2a50d.