TYPO3 either fix or disable error log

Hi,

how would I deactivate TYPO3 error logging completely and switch back to apache logs?

The error log of some projects is completely clogged up with tons of errors of these kinds:

  1. Request parameters could not be validated (&cHash comparison failed)
  2. The requested page does not exist!
  3. The requested page alias does not exist

All of them are fruitless discovery attempts by hackers. Those error messages in their quantity don’t have any value to me and the button “delete similar errors” doesn’t work very well. Also it is impossible to delete all errors of a certain time range or other filter. I keep having to clean up the log by sql commands.

Generally it would be nice to have important error logs accessible in the TYPO3 backend, but the way it is I’d rather save the DB and file space and rely on the rotating apache logs.

How do you guys deal with this issue? Did I miss something? I already use this to suppress warnings:

$GLOBALS['TYPO3_CONF_VARS']['LOG']['TYPO3']['CMS'] = [
    'Core' => [
        'Resource' => [
            'ResourceStorage' => [
                'writerConfiguration' => [
                    \TYPO3\CMS\Core\Log\LogLevel::ERROR => [
                        \TYPO3\CMS\Core\Log\Writer\FileWriter::class => [],
                        \TYPO3\CMS\Core\Log\Writer\DatabaseWriter::class => []
                    ]
                ]
            ]
        ]
    ]
];

But it’s still far too much and I don’t seem to be able to configure just those three error types.

Best regards

EDIT: TYPO3 version is 9.5

1 Like

So, you want to log to files, but not to the database table sys_log which can be viewed in the TYPO3 backend in the log module?

Have you checked out Global Configuration [SYS][belogErrorReporting] ? Set this to 0 do deactivate error logging in sys_log database table.

What you can’t disable - as far as I know - is logging of exceptions to sys_log. See also https://forge.typo3.org/issues/90323

You can use the logging framework with FileWriter to log to a file (or files). The configuration you used above actually configures the logging framework. The file can be a different location from the default in TYPO3 - you can put it somewhere where it will regularly be logrotated (make sure web user has write access to directory).

Alternatively, you can use SyslogWriter which will write to the syslog (system log, not sys_log table).


Think of logging via logging framework (new) and logging to sys_log (old) as 2 separate things. If this is confusing, yes it actually is.


But, you can also regularly clean sys_log table, see for example scheduler task “table garbage collection” or do it via a SQL command regularly.

Thank you very much for this detailed reply, Sybille.

I will take the scheduler task “table garbage collection” into consideration but I think that Log Writers section of the core api is exactly the information I was looking for.

I have to admit that I more or less copied and slightly adjusted the configuration above without knowing that there were more options then FileWriter and DatabaseWriter.

SyslogWriter or PhpErrorLogWriter (all my TYPO3 instances run on their own php-fpm configurations with their own configured error logs) might be a good start right now.

What really peaks my interest are the custom log writers. I will most definitely give it a try as soon as I can make some time for it.

What I would also like to recommend are the sentry / TYPO3 logging solutions. This may take a little more effort to set up but it is worthwhile. I tested the solution by Helmut Hummel, am not using this yet in production, but was quite impressed by the functionality: https://github.com/helhum/sentry-typo3