#94356Embrace PSR-3
Description
General:
- Part 1: Get rid of everything that does not use psr-3 logging currently.
- Part 2 & 3: Refine our logging implementation and configuration, adapt ext:belog.
This epic is about Part 1 for now. Main goal: writing to sys_log only via DatabaseWriter, all other implementations should fall (deprecated), no manual querying of sys_log anymore like in DataHandler (anywhere else?), except ext:belog. Probably keep ext:belog and sys_log schema as is, for now.
- (#94315): Move to proper PSR-3 logging format.
- Transition all places that write to sys_log to use PSR-3 logger instead, configure DatabaseWriter for them
- DataHandler: This one uses be_user->writelog() via log() and newlog(). Look into these calls, use logger instead and also have a look at classes that may call DataHandler->log() and DataHandler->newlog() (they’re public and I’d bet things like RelationHandler may use that). Configure DataHandler logger to use DatabaseWriter, and adapt DatabaseWriter to de-normalize towards the existing fields log() and newlog() wrote to.
- DataHandler: Consider additionally configuring memoryWriter to gather log rows of one request. See printLogErrorMessages() which currently queries sys_log to turn errors into flash messages if in web context. This could be fetched from MemoryWriter instead?
- Adapt Other places that call be_user->writelog
- Deprecate be_user->writelog
- Configure DatabaseWriter for ExceptionHandler and drop the manual insert query to sys_log in AbstractExceptionHandler. Keep an eye on bootstrap: What happens if a parse error happens in early bootstrap due to a broken (3rd party) extension? Is logging properly initialized and it’s still logged to sys_log in this case?
- See if other places insert / select sys_log, adapt, eventually deprecate them.
Reviews 7
- 12.4 84807[BUGFIX] Add scheduler task exception to error message
- main 84152[BUGFIX] Add scheduler task exception to error message
- main 70842[FEATURE] Add monolog as alternative logger implementation
- main 69663[TASK] Switch belog to use channels, not types
- main 69656[TASK] Add a channel column to sys_log
- main 69500[TASK] Improve code tidiness in the logger
- main 69425[BUGFIX] Make logger usage PSR-3 compliant
Subtasks 10
- Bug #94315Use PSR-3 interpolation
- Task #94352Tidy up logging framework
- Task #94369Use PSR-3 logger exclusively in ErrorHandler
- Bug #94382Allow all Throwables in log formatting
- Task #94383Remove sys_log writes from ExceptionHandler
- Task #94395Remove sys_log writes from PasswordReset
- Task #94433Add channel column to sys_log table
- Task #94439Switch belog to use channels
- Feature #94600Use Monolog for injected logging services
- Task #97145Migrate sys_log serialized data to JSON content