Project

General

Profile

Actions

Feature #90639

closed

Make logging of URL of current page configurable by using a new UrlProcessor?

Added by Sybille Peters about 4 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Logging
Target version:
-
Start date:
2020-03-04
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

I sometimes miss the information about the current URL of page when error occured in the logs. What I have evaluated:

  • URL gets added in exception handler (see AbstractExceptionHandler::writeLogEntries(), "Requested URL:"
  • So, the URL does not get added to the logs if it's not an exception.
  • If you are not using the debug preset but the production preset, you will not see the URL in the log.
  • On the other hand, you cannot disable the logging of the URL for exception handler.
  • The URL gets written into the log message, not into data.

Reproduce

  • set configuration preset to production
  • trigger a warning or error

use defaults in logging framework (for error) or change to log warnings as well:

$GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'] = [  
  // FileWriter
  \TYPO3\CMS\Core\Log\LogLevel::WARNING => [
        \TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
            'logFile' => $logfile
        ]
    ]
];

output in log

Wed, 04 Mar 2020 15:18:10 +0100 [WARNING] request="2f223319e0531" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Invalid argument supplied for foreach() in /var/www/mysite/...path .../TriggerError.php line 7 

Desired outcome

Wed, 04 Mar 2020 15:18:10 +0100 [WARNING] request="2f223319e0531" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Invalid argument supplied for foreach() in /var/www/mysite/...path .../TriggerError.php line 7 - {"context":"FE","url":"https://mysite/start/triggererror"}

Proposed solution

Use a new UrlProcessor to add the URL (if not cli, as already done in AbstractExceptionHandler). Add this to data, not to the log message. Do not add the URL in other places.

You can already do this by adding your own UrlProcessor now, but then in some cases the URL gets added twice.

There is already a WebProcessor but that adds a lot more.

Actions #1

Updated by Sybille Peters over 2 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF