Bug #84646
closedException in ErrorHandler if problem instantiating logger (Reboustness)
100%
Description
In the BE the following error is displayed if the logging api is enabled:
Fatal error: Uncaught Error: Call to a member function log() on null in /var/www/t3coredev/typo3/sysext/core/Classes/Error/ErrorHandler.php on line 132
( ! ) Error: Call to a member function log() on null in /var/www/t3coredev/typo3/sysext/core/Classes/Error/ErrorHandler.php on line 132
I am using a current master (TYPO3 9.2-dev).
I use a similar snippet in several TYPO3 8 instances:
typo3conf/AdditionalConfiguration.php:
$GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'] = [
// configuration for ERROR level log entries
\TYPO3\CMS\Core\Log\LogLevel::ERROR => [
// add a FileWriter
'TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter' => [
// configuration for the writer
'logFile' => 'typo3temp/logs/typo3-error.log'
]
],
\TYPO3\CMS\Core\Log\LogLevel::DEBUG => [
// add a FileWriter
'TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter' => [
// configuration for the writer
'logFile' => 'typo3temp/logs/typo3-debug.log'
]
]
];
ErrorHandler uses the new loggerAwareTrait functionality, so that should be fine.
Files
Updated by Markus Klein over 6 years ago
1) typo3temp/logs/typo3-error.log should actually be typo3temp/var/logs/typo3-error.log since v8
2) The logging API is always enabled independent of any configuration you add yourself
3) Does it work if you remove your configuration?
4) Do you have a stacktrace showing why the ErrorHandler is called firstplace?
Updated by Sybille Peters over 6 years ago
- File stacktrace.png stacktrace.png added
I narrowed it down: It was a permission problem for my path `typo3temp/logs`. I had manually created that, webserver did not have write permission. Will use the path you pointed out in the future.
Still sending the stacktrace for reference.
Stack trace:
PHP Fatal error: Uncaught Error: Call to a member function log() on null
in /var/www/t3coredev/typo3/sysext/core/Classes/Error/ErrorHandler.php:132
Stack trace:
#0 [internal function]: TYPO3\\CMS\\Core\\Error\\ErrorHandler->handleError(2, 'fopen(/var/www/...', '/var/www/t3core...', 1925, Array)
#1 /var/www/t3coredev/typo3/sysext/core/Classes/Utility/GeneralUtility.php(1925):
fopen('/var/www/t3core...', 'wb')
#2 /var/www/t3coredev/typo3/sysext/core/Classes/Log/Writer/FileWriter.php(197):
TYPO3\\CMS\\Core\\Utility\\GeneralUtility::writeFile('/var/www/t3core...', '')
#3 /var/www/t3coredev/typo3/sysext/core/Classes/Log/Writer/FileWriter.php(160):
TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter->createLogFile()
#4 /var/www/t3coredev/typo3/sysext/core/Classes/Log/Writer/FileWriter.php(95):
TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter->openLogFile()
#5 /var/www/t3coredev/typo3/sysext/core/Classes/Log/Writer/AbstractWriter.php(35):
TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter->setLogFile('typo3temp/logs/...')
#6 /var/www/t3coredev/typo3/sysext/core/Classes/Log/Writer/ in /var/www/t3coredev
/typo3/sysext/core/Classes/Error/ErrorHandler.php on line 132
Updated by Gerrit Code Review over 6 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56598
Updated by Sybille Peters over 6 years ago
- Related to Bug #84654: If problem with creation of logger, an Exception is thrown: A cache with identifier "assets" does not exist added
Updated by Sybille Peters over 6 years ago
- Subject changed from Exception in ErrorHandler as soon as logging API is enabled. to Exception in ErrorHandler if problem instantiating logger (Reboustness)
Updated by Markus Klein over 6 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 125e3463f671ef9a4cb7453cd30a6405132619b0.