nixpkgs/home/files/typo3-configuration/Logging.php
Daniel Siepmann db69b0d781
Improve TYPO3 logging
Always add URL to all log entries.
Remove one time used processor.
Always log warnings and deprecations (with URLs).
2023-10-30 15:07:40 +01:00

48 lines
1.4 KiB
PHP

<?php
namespace Codappix\CdxLogging;
use TYPO3\CMS\Core\Log\LogRecord;
use TYPO3\CMS\Core\Log\Processor\AbstractProcessor;
use TYPO3\CMS\Core\Log\Processor\ProcessorInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class UriProcessor extends AbstractProcessor implements ProcessorInterface
{
public function processLogRecord(LogRecord $logRecord)
{
$logRecord->addData([
'URI' => GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'),
]);
return $logRecord;
}
}
$GLOBALS['TYPO3_CONF_VARS']['LOG']['das']['writerConfiguration'] = [
\TYPO3\CMS\Core\Log\LogLevel::DEBUG => [
\TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
'logFileInfix' => 'das',
],
],
];
$GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'] = [
\TYPO3\CMS\Core\Log\LogLevel::WARNING => [
\TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
'logFileInfix' => 'warn',
],
],
];
$GLOBALS['TYPO3_CONF_VARS']['LOG']['processorConfiguration'] = [
\TYPO3\CMS\Core\Log\LogLevel::DEBUG => [
\Codappix\CdxLogging\UriProcessor::class => [
],
],
];
$GLOBALS['TYPO3_CONF_VARS']['LOG']['TYPO3']['CMS']['deprecations']['writerConfiguration'] = [
\TYPO3\CMS\Core\Log\LogLevel::NOTICE => [
\TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
'logFileInfix' => 'deprecation',
],
],
];