Bug #87820

Logger not instanciated in cache backend

Added by Marco Dinnbier 6 months ago. Updated 9 days ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Logging
Target version:
Start date:
2019-03-01
Due date:
% Done:

100%

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

Description

The function setLogger is never called in cache backend.
The cache backend is instanciated via 'new' and not via GeneralUtility::makeInstance in TYPO3\CMS\Core\Cache\CacheManager::createCache.

This leads to an error, when the logger in cache backend class is needed: 'Core: Exception handler (WEB): Uncaught TYPO3 Exception: Call to a member function alert() on null ...'


Related issues

Related to TYPO3 Core - Bug #88938: wrong class statement for logger initialization Resolved 2019-08-08
Duplicated by TYPO3 Core - Bug #88775: logger in ApcuBackend is not instantiated Resolved 2019-07-16

Associated revisions

Revision 524b6701 (diff)
Added by Anja Leichsenring 9 days ago

[BUGFIX] Instantiate Logger on cache backend creation

Cache backends are created via new, not using GU::makeInstance.
So it happened no cache has been initialized, causing errors upon
calls for the logger.
Putting cache creation into the cache backend constructor solves
the problem and makes sure the logger is always available.

Resolves: #88775
Resolves: #87820
Releases: master, 9.5
Change-Id: I4005b812e96c028528f3740c581b8086cfc592f0
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61472
Tested-by: TYPO3com <>
Tested-by: Frank Naegler <>
Tested-by: Andreas Fernandez <>
Reviewed-by: Frank Naegler <>
Reviewed-by: Andreas Fernandez <>

Revision 81879885 (diff)
Added by Anja Leichsenring 9 days ago

[BUGFIX] Instantiate Logger on cache backend creation

Cache backends are created via new, not using GU::makeInstance.
So it happened no cache has been initialized, causing errors upon
calls for the logger.
Putting cache creation into the cache backend constructor solves
the problem and makes sure the logger is always available.

Resolves: #88775
Resolves: #87820
Releases: master, 9.5
Change-Id: I4005b812e96c028528f3740c581b8086cfc592f0
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61460
Tested-by: TYPO3com <>
Tested-by: Andreas Fernandez <>
Reviewed-by: Andreas Fernandez <>

History

#1 Updated by Benni Mack 6 months ago

Hmm, this is a tricky one.

Basically, because AbstractBackend is a LoggerAwareInterface, basically all caches that are used until ext_localconf.phps are loaded (cache_core, assets) will not have their final Logger Configuration set. We can add this manually, which would make sense, but this might result in more side-effects...

But the solution for this patch would be: createCache() checks for the LoggerAwareInterface and puts in the code, like makeInstance does it.

#2 Updated by Susanne Moog 6 months ago

  • Category set to Logging

#3 Updated by Daniel Windloff 23 days ago

  • Duplicated by Bug #88775: logger in ApcuBackend is not instantiated added

#4 Updated by Stephan Ederer 10 days ago

This bug is a showstopper.
We've got redundant server nodes. If one node is down the website is still online.
But if the Redis-Server is down (for maintenance e.g.), the webside is down too.

#5 Updated by Susanne Moog 10 days ago

  • Target version set to next-patchlevel

#6 Updated by Gerrit Code Review 10 days 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/c/Packages/TYPO3.CMS/+/61472

#7 Updated by Gerrit Code Review 10 days ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61472

#8 Updated by Gerrit Code Review 10 days ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61472

#9 Updated by Gerrit Code Review 10 days ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61472

#10 Updated by Gerrit Code Review 9 days ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61460

#11 Updated by Anja Leichsenring 9 days ago

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

#12 Updated by Anja Leichsenring 9 days ago

  • Related to Bug #88938: wrong class statement for logger initialization added

Also available in: Atom PDF