[GH-ISSUE #745] SlackHandler ignores includeStacktraces #280

Closed
opened 2026-03-04 02:13:44 +03:00 by kerem · 4 comments
Owner

Originally created by @websirnik on GitHub (Mar 16, 2016).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/745

I'm using MonologBundle to include stacktraces in logs. It works for StreamHandler, but not for Slack.

monolog:
    handlers:
        main:
            type:  stream
            path:  %kernel.logs_dir%/%kernel.environment%.log
            level: error
            include_stacktraces: true
        slack:
            type: slack
            token: xxx
            channel: "#errors"
            bot_name: ErrorBot
            icon_emoji: :ghost:
            level: critical
            include_stacktraces: true
Originally created by @websirnik on GitHub (Mar 16, 2016). Original GitHub issue: https://github.com/Seldaek/monolog/issues/745 I'm using MonologBundle to include stacktraces in logs. It works for StreamHandler, but not for Slack. ``` yaml monolog: handlers: main: type: stream path: %kernel.logs_dir%/%kernel.environment%.log level: error include_stacktraces: true slack: type: slack token: xxx channel: "#errors" bot_name: ErrorBot icon_emoji: :ghost: level: critical include_stacktraces: true ```
kerem 2026-03-04 02:13:44 +03:00
  • closed this issue
  • added the
    Feature
    label
Author
Owner

@Seldaek commented on GitHub (Apr 2, 2016):

Yeah, the problem seems to be SlackHandler uses LineFormatter::stringify which doesn't handle exceptions, and it also doesn't use this->getFormatter() like the include_stacktrace does.. lots of small problems which make it not so easy to fix, but it sure isn't impossible :)

<!-- gh-comment-id:204714162 --> @Seldaek commented on GitHub (Apr 2, 2016): Yeah, the problem seems to be SlackHandler uses LineFormatter::stringify which doesn't handle exceptions, and it also doesn't use this->getFormatter() like the include_stacktrace does.. lots of small problems which make it not so easy to fix, but it sure isn't impossible :)
Author
Owner

@LeniM commented on GitHub (Aug 11, 2016):

I think you can do it with a formater.
In my case I just used a global handler that does $e->__toString() before sending it to slack. works fine

<!-- gh-comment-id:239112656 --> @LeniM commented on GitHub (Aug 11, 2016): I think you can do it with a formater. In my case I just used a global handler that does $e->__toString() before sending it to slack. works fine
Author
Owner

@gmponos commented on GitHub (Mar 18, 2018):

Hi @websirnik does the problem still occur?

Can you check this #1127 and tell me if this happens also for you?

<!-- gh-comment-id:373984790 --> @gmponos commented on GitHub (Mar 18, 2018): Hi @websirnik does the problem still occur? Can you check this #1127 and tell me if this happens also for you?
Author
Owner

@Seldaek commented on GitHub (Jun 18, 2018):

Closing as no activity here in a while.

<!-- gh-comment-id:398018537 --> @Seldaek commented on GitHub (Jun 18, 2018): Closing as no activity here in a while.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#280
No description provided.