Deprecation: #109295 - DatabaseWriter::setLogTable()/getLogTable() 

See forge#109295

Description 

The methods setLogTable() and getLogTable() of \TYPO3\CMS\Core\Log\Writer\DatabaseWriter have been deprecated.

DatabaseWriter is a dedicated writer for the sys_log table. Its writeLog() method maps LogRecord fields to the sys_log schema ( request_id, time_micro, component, level, message, data, tstamp). Allowing an arbitrary table via setLogTable() creates a false sense of flexibility: any custom table would have to replicate the full sys_log schema to work correctly.

The long-term goal is to make DatabaseWriter final and remove the $logTable property entirely.

Impact 

Calling setLogTable() or getLogTable() triggers a PHP E_USER_DEPRECATED error. This includes passing logTable as a configuration option when DatabaseWriter is registered via $GLOBALS['TYPO3_CONF_VARS']['LOG'] , since the AbstractWriter constructor resolves options to set*() calls.

Support will be removed in TYPO3 v15.0.

Affected installations 

Installations that configure DatabaseWriter with a custom logTable option, or that call setLogTable() / getLogTable() directly on a DatabaseWriter instance.

The extension scanner detects direct calls to ->setLogTable() and ->getLogTable(). The more common case — passing logTable as a configuration option via $GLOBALS['TYPO3_CONF_VARS']['LOG'] — cannot be detected automatically and requires a manual search for DatabaseWriter usages with a logTable key.

Migration 

Replace DatabaseWriter with a dedicated writer that extends \TYPO3\CMS\Core\Log\Writer\AbstractWriter and implements writeLog() with explicit field mapping for the custom table.

Before (deprecated):

$GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'][\Psr\Log\LogLevel::WARNING] = [
    \TYPO3\CMS\Core\Log\Writer\DatabaseWriter::class => ['logTable' => 'my_custom_log'],
];
Copied!

After:

// EXT:my_extension/Classes/Log/Writer/MyCustomTableWriter.php
namespace MyVendor\MyExtension\Log\Writer;

use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Log\LogRecord;
use TYPO3\CMS\Core\Log\Writer\AbstractWriter;
use TYPO3\CMS\Core\Log\Writer\WriterInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class MyCustomTableWriter extends AbstractWriter
{
    public function writeLog(LogRecord $record): WriterInterface
    {
        GeneralUtility::makeInstance(ConnectionPool::class)
            ->getConnectionForTable('my_custom_log')
            ->insert('my_custom_log', [
                'created' => (int)$record->getCreated(),
                'level'   => $record->getLevel(),
                'message' => $record->getMessage(),
            ]);
        return $this;
    }
}
Copied!
$GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'][\Psr\Log\LogLevel::WARNING] = [
    \MyVendor\MyExtension\Log\Writer\MyCustomTableWriter::class => [],
];
Copied!