Bug #84646
closed
Exception in ErrorHandler if problem instantiating logger (Reboustness)
Added by Sybille Peters over 6 years ago.
Updated about 6 years ago.
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
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?
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
- Status changed from New to Under Review
- Description updated (diff)
- Related to Bug #84654: If problem with creation of logger, an Exception is thrown: A cache with identifier "assets" does not exist added
- Subject changed from Exception in ErrorHandler as soon as logging API is enabled. to Exception in ErrorHandler if problem instantiating logger (Reboustness)
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF