Monolog Slack Integration Not Sending Logs

Created on 21 July 2024, 5 months ago
Updated 6 August 2024, 5 months ago

Problem/Motivation

We are trying to use the Monolog module to manage our logging in a Drupal project. While dblog, syslog, and file logging work correctly, the Slack integration does not work as expected. No logs are being sent to the designated Slack channel, whether it is a private or a public channel.

Steps to reproduce

  1. Configure Monolog with the provided configuration:
  2. parameters:
      monolog.channel_handlers:
        php: ['rotating_file']
        salesforce.slack:
          handlers:
            - name: 'slack2'
        content: [ 'syslog']
        default: ['drupal.dblog']
    
    services:
      monolog.handler.rotating_file:
        class: Monolog\Handler\RotatingFileHandler
        arguments: ['private://logs/debug.log', 10, 'DEBUG']
      monolog.handler.rotating_file_salesforce:
        class: Monolog\Handler\RotatingFileHandler
        arguments: ['private://logs/debug_salesforce.log', 10, 'DEBUG']
      monolog.handler.syslog:
        class: Monolog\Handler\SyslogHandler
        arguments: ['myfacility', 'local6', 'DEBUG']
      monolog.handler.slack:
        class: Monolog\Handler\SlackWebhookHandler
        arguments: ['https://hooks.slack.com/services/ANONYMOUS/ANONYMOUS/ANONYMOUS', '#market-dev-test', 'LID DEV']
      monolog.handler.slack2:
        class: Monolog\Handler\SlackHandler
        arguments: ['xoxb-ANONYMOUS-ANONYMOUS-ANONYMOUS', 'test', 'lid', false, null]
    
  3. Trigger log messages that should be sent to Slack.
  4. Observe that no messages are received in the Slack channel.

Proposed Resolution

Could someone test the Slack integration?

Here is the information to check:

  • Which Slack webhook URL and token are being used?
  • What Slack bot/user permissions are set?
  • Testing with different Slack channel settings (public vs. private).

Remaining tasks

  • Verify the current configuration and credentials.
  • Test logging with correct and updated credentials.
  • Check permissions for the Slack bot/user.
  • Document any changes or fixes applied.

User interface changes

None.

API changes

None.

Data model changes

None.

thanks for your help !

💬 Support request
Status

Fixed

Version

3.0

Component

Documentation

Created by

🇫🇷France vanilla-bear

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

Comments & Activities

Production build 0.71.5 2024