Project

General

Profile

Actions

Bug #84646

closed

Exception in ErrorHandler if problem instantiating logger (Reboustness)

Added by Sybille Peters over 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Logging
Target version:
-
Start date:
2018-04-06
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

stacktrace.png (170 KB) stacktrace.png Sybille Peters, 2018-04-06 17:19

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #84654: If problem with creation of logger, an Exception is thrown: A cache with identifier "assets" does not existClosed2018-04-07

Actions
Actions #1

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?

Actions #2

Updated by Sybille Peters over 6 years ago

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
Actions #3

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

Actions #4

Updated by Sybille Peters over 6 years ago

  • Description updated (diff)
Actions #5

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
Actions #6

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)
Actions #7

Updated by Markus Klein over 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #8

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF