AutologoutManager should use type from psr/log package

Created on 8 August 2024, about 1 month ago
Updated 20 August 2024, 27 days ago

Problem/Motivation

Using some other library to log things than dblog you can get different variations of this message:

TypeError: Cannot assign Psr\Log\NullLogger to property Drupal\autologout\AutologoutManager::$logger of type Drupal\Core\Logger\LoggerChannelInterface in Drupal\autologout\AutologoutManager->__construct() (line 136 of modules/contrib/autologout/src/AutologoutManager.php).

In core, loggers are always assigned to LoggerInterface from the package psr/log. We should do that here as well, to support all kinds of loggers.

Steps to reproduce

Install for example monolog and use another logger as default than dblog

Proposed resolution

Use the other interface

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

πŸ‡³πŸ‡΄Norway eiriksm Norway

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

Merge Requests

Comments & Activities

  • Issue created by @eiriksm
  • Merge request !63Use other interface β†’ (Open) created by eiriksm
  • Status changed to Needs review about 1 month ago
  • πŸ‡³πŸ‡΄Norway eiriksm Norway
  • Pipeline finished with Success
    about 1 month ago
    Total: 454s
    #247711
  • πŸ‡ΊπŸ‡ΈUnited States scott_earnest

    Hello @eiriksm-

    I am sorry, but I am unable to reproduce this error. Would you be able to provide some additional information for steps to reproduce?

    Also I see that the MR is against the 8.x-1.x branch, which I see is the default, but this ticket is linked to 2.x.

    I am testing with these steps, prior to enabling the patch
    - disable the "dblog" module
    - enable the "monolog" module, following "Quickstart" instructions
    - enabled autologout and tested
    - verified I got a log entry in the "debug-*.log" file, similar to:
    autologout.INFO: Session automatically closed for test by autologout.

    I tested both versions 8.x-1.x on Drupal 9, and version 2.x on Drupal 10, and was not able to reproduce the error.

    Thank you kindly for your help with this ticket.

  • Status changed to Closed: duplicate 27 days ago
  • πŸ‡ΊπŸ‡ΈUnited States scott_earnest

    I think this is a duplicate of this issue. Also I see the issue could be related to Drupal core 10.2 -> 10.3 update.

    https://www.drupal.org/project/autologout/issues/3466843 πŸ› AutologoutManager should use type from psr/log package Closed: duplicate

Production build 0.71.5 2024