ECA doesn't work with the monolog module

Created on 31 January 2024, about 1 year ago
Updated 1 August 2024, 9 months ago

Problem/Motivation

When the monolog module is enabled, Psr\Log\NullLogger gets passed to ConfigurableLoggerChannel which causes a type error.

Steps to reproduce

Install and enable the monolog module alongside eca, you'll see a white screen error.

Proposed resolution

Patch added to allow the parameter of NullLogger.

💬 Support request
Status

Closed: outdated

Version

2.0

Component

Code

Created by

🇦🇪United Arab Emirates leslie.cordell Dubai

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @leslie.cordell
  • 🇦🇪United Arab Emirates leslie.cordell Dubai
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Thanks @leslie.cordell for reporting this. I think there is a better way of addressing it. Instead of adding a second option for the parameter class, we should replace the existing one with \Psr\Log\LoggerInterface, since both \Psr\Log\NullLogger and \Drupal\Core\Logger\LoggerChannelInterface are either implementing or extending that interface.

    However, there is a bigger issue here: all of the methods contained in ConfigurableLoggerChannel are calling methods that won't be available in the monolog context, if that passes a NullLogger in. So, for each of those methods, we would have to add some validations, if the called method even exists, or if $loggerChannel instanceof LoggerChannelInterface.

    But that's not really nice, since that may have some performance impact. So I wonder, is it really correct, that monolog passes a NullLogger in? Maybe the real problem doesn't lie in ECA here but monolog does something wrong? I'm just asking the question, haven't checked what and why that other module is doing this.

    Now, should we get back to code contributions then, we're not working with patches anymore. Things are now only handled with issue forks and merge requests. Also, bug fixes will always go into the latest release (2.0.x in this case) and then probably get back ported to older supported releases.

  • Status changed to Postponed: needs info about 1 year ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    We need more information before we can come up with a plan. Changing issue properties in the meantime.

  • Status changed to Closed: outdated 9 months ago
  • 🇩🇪Germany jurgenhaas Gottmadingen
Production build 0.71.5 2024