Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Work in progress Orphaned

78017[TASK] Make the ErrorHandler log the request url

Rémy DANIEL CR -1 V 0 Easy +37 −9 updated 03/21/25, 14:56

Commit message

The ErrorHandler now appends the requested url to the log message,
like done in AbstractExceptionHandler.
This make the analysis of a log message easier.

This change also introduces \TYPO3\CMS\Core\Security\AnonymizeTokenTrait
in order to share the anonymizeToken function between the two handlers.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 1
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/17/78017/1 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/17/78017/1 && git cherry-pick FETCH_HEAD

Review

  • Code review CR -1 Needs a vote
    • Sybille Peters +1
    • Christian Kuhn -1
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Issues 1

Files 3

Review log 1112

  1. Rémy DANIEL uploaded patch set 1 03/03/23, 16:46

  2. Rémy DANIEL marked it work in progress 03/03/23, 16:47

  3. Rémy DANIEL commented on patch set 1 03/03/23, 16:48

    Unresolved

    I would like to know if the introduction of the trait is okay
  4. Rémy DANIEL commented on patch set 1 03/03/23, 16:52

    Unresolved

    I would also like to know if the test coverage of the trait is okay if it remains in the ProductionExceptionHandlerTest or if it needs a test refactoring.
  5. core-ci voted on patch set 1 V +1 03/03/23, 16:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38366

  6. Christian Kuhn commented on patch set 1 CR -1 03/03/23, 17:23

    ErrorHandler.php:141

    we shouldn'd add calls to GU::getIndpEnv() since this adds a technical debt to and API that should vanish. using globals['tyop3_request'] is no suitable solution, either.
  7. Rémy DANIEL commented on patch set 1 03/03/23, 18:27

    This change is ready for review.

    ErrorHandler.php:141 Reply

    OK. But GU::getIndpEnv() is already used like that in AbstractExceptionHandler. Until there is a good replacement, I would like to use it also in ErrorHandler.
  8. Rémy DANIEL commented on patch set 1 09/21/23, 20:57

    ErrorHandler.php:141 Reply

    Lolli, can we just use the same (yet unperfect) API than in \TYPO3\CMS\Core\Error\AbstractExceptionHandler::writeLogEntries?
  9. Oli Bartsch commented on patch set 1 09/22/23, 07:39

    ErrorHandler.php:141 Reply

    Since access to $GLOBALS['TYPO3_REQUEST'] is already done in getFormattedLogMessage(), I personally would be fine to also use it here. However, we should add a separate method "getRequest(): ServerRequestInterface" to encapsulate the usage of this "API".
  10. Rémy DANIEL commented on patch set 1 09/29/23, 08:45

    ErrorHandler.php:141 Reply

    Tests will need adjustments (a fake TYPO3_REQUEST needs to be set instead of TYPO3_REQUEST_URL env). Please let me know what method is preferable. The initial idea is just to align the log of the request url ErrorHandler and ExceptionHandler.
  11. Sybille Peters commented on patch set 1 CR +1 10/27/23, 06:09

    ErrorHandler.php:141 Reply Unresolved

    +1 for patch but looks like it is stuck. I also think this would be useful to always have the URLs in the logs, not just for exceptions. (Used a custom FileWriter to add it a while ago as a work-around). Will ask in typo3-cms-coredev Slack about recommended way to get the request URL.
  12. Benni Mack marked it work in progress 03/21/25, 14:56