PHPackages                             macpaw/sentry-monolog-adapter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. macpaw/sentry-monolog-adapter

ActiveSymfony-bundle[Logging &amp; Monitoring](/categories/logging)

macpaw/sentry-monolog-adapter
=============================

Sentry monolog logging bundle

v1.1.0(9mo ago)25232.9k↓43.6%2[1 PRs](https://github.com/MacPaw/sentry-monolog-adapter/pulls)MITPHPPHP ^8.1CI passing

Since Apr 28Pushed 9mo ago7 watchersCompare

[ Source](https://github.com/MacPaw/sentry-monolog-adapter)[ Packagist](https://packagist.org/packages/macpaw/sentry-monolog-adapter)[ Docs](https://github.com/MacPaw/sentry-monolog-adapter)[ RSS](/packages/macpaw-sentry-monolog-adapter/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (12)Used By (0)

Symfony Sentry Monolog Adapter
==============================

[](#symfony-sentry-monolog-adapter)

VersionBuild StatusCode Coverage`master`[![CI](https://github.com/macpaw/sentry-monolog-adapter/workflows/CI/badge.svg?branch=master)](https://github.com/macpaw/sentry-monolog-adapter/actions?query=workflow%3ACI+branch%3Amaster)[![Coverage Status](https://camo.githubusercontent.com/7451de014a974a54388b6bc18d0f6c33b8c43c8491aad8938a535045130b6bd0/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6d61637061772f73656e7472792d6d6f6e6f6c6f672d616461707465722f6d61737465723f6c6f676f3d636f6465636f76)](https://codecov.io/gh/macpaw/sentry-monolog-adapter/branch/master)`develop`[![CI](https://github.com/macpaw/sentry-monolog-adapter/workflows/CI/badge.svg?branch=develop)](https://github.com/macpaw/sentry-monolog-adapter/actions?query=workflow%3ACI+branch%3Adevelop)[![Coverage Status](https://camo.githubusercontent.com/8272895c4235ad9a15f7338c1c1cafcbe25bca10b7f4ab64e43ee44bc48efcac/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6d61637061772f73656e7472792d6d6f6e6f6c6f672d616461707465722f646576656c6f703f6c6f676f3d636f6465636f76)](https://codecov.io/gh/macpaw/sentry-monolog-adapter/branch/develop)The Sentry Monolog Adapter is a Symfony bundle designed to enhance and provide granular control over logging to Sentry. It is particularly powerful for applications that use the Symfony Messenger component, allowing you to implement intelligent logging strategies to avoid log floods and focus on critical errors.

### Key Features

[](#key-features)

- **Advanced Log Processing**: Utilizes a decorator for Monolog's Sentry handler to process and enrich log records before they are sent.
- **Customizable Processors**: Add your own processors to include or modify contextual data, with a built-in `ExceptionProcessor` to get you started.
- **Intelligent Messenger Logging**: A dedicated middleware for the Symfony Messenger component that allows you to control which messages are logged based on flexible strategies.
- **Built-in Logging Strategies**: A suite of strategies is provided out-of-the-box, including:
    - `LogAllFailedStrategy`: Only logs messages that fail.
    - `LogAfterPositionStrategy`: Logs messages after a specific number of retries.
    - `ArithmeticProgressionStrategy`: Logs based on an arithmetic sequence of retry attempts.
    - And several others to fit your needs.
- **Modern and Compatible**: Built for PHP 8.1+ and compatible with `sentry/sentry-symfony` v5.

Installation
============

[](#installation)

Step 1: Download the Bundle
---------------------------

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute:

### Applications that use Symfony Flex

[](#applications-that-use-symfony-flex)

```
$ composer require macpaw/sentry-monolog-adapter
```

### Applications that don't use Symfony Flex

[](#applications-that-dont-use-symfony-flex)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require macpaw/sentry-monolog-adapter
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

Step 2: Enable the Bundle
-------------------------

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `app/AppKernel.php` file of your project:

```
