PHPackages                             moston/magento2-sentry - 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. moston/magento2-sentry

ActiveMagento2-module[Logging &amp; Monitoring](/categories/logging)

moston/magento2-sentry
======================

Magento 2 Logger for Sentry

4.0.2(1y ago)012MITPHPPHP &gt;=8.3

Since Apr 10Pushed 1y agoCompare

[ Source](https://github.com/moston/magento2-sentry)[ Packagist](https://packagist.org/packages/moston/magento2-sentry)[ RSS](/packages/moston-magento2-sentry/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (8)Versions (4)Used By (0)

Magento 2 Sentry Logger
=======================

[](#magento-2-sentry-logger)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5a55def64c536babb2212960782190110cedbab3f54f54f5fc4f645aaa24de99/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a7573746265747465722f6d6167656e746f322d73656e7472792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/justbetter/magento2-sentry)[![Total Downloads](https://camo.githubusercontent.com/668b9fa91f4812b82343c73957867b2b4fdae1554d833c678a1891e5aac7b9d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a7573746265747465722f6d6167656e746f322d73656e7472792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/justbetter/magento2-sentry)[![Magento Support](https://camo.githubusercontent.com/ee7b4da726b9309217b9970507e54c4272512d1f4ff39283999e4afc867f265a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d6167656e746f2d322e342d6f72616e67652e7376673f6c6f676f3d6d6167656e746f266c6f6e6743616368653d74727565267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/ee7b4da726b9309217b9970507e54c4272512d1f4ff39283999e4afc867f265a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d6167656e746f2d322e342d6f72616e67652e7376673f6c6f676f3d6d6167656e746f266c6f6e6743616368653d74727565267374796c653d666c61742d737175617265)[![PHPStan passing](https://camo.githubusercontent.com/b392742a9f8260f2b602a5dde85a66436da96bdc2150930ac47f88b731f617f7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a7573746265747465722f6d6167656e746f322d73656e7472792f616e616c7973652e796d6c3f6c6162656c3d5048505374616e267374796c653d666c61742d737175617265)](https://github.com/justbetter/magento2-sentry/actions/workflows/analyse.yml)

This Magento 2 module integrates the [Sentry sdk](https://github.com/getsentry/sentry-php) into magento 2. Depending on the log level configured in the backend of magento 2, notifications and errors can be send to sentry.

Installation
------------

[](#installation)

- `composer require justbetter/magento2-sentry`
- `bin/magento module:enable JustBetter_Sentry`
- `bin/magento setup:upgrade`
- `bin/magento setup:di:compile`
- `bin/magento setup:static-content:deploy`

Configuration
-------------

[](#configuration)

For configuration with Adobe Cloud, [check below](#configuration-for-adobe-cloud).

This module uses the [Magento Deployment Configuration](https://devdocs.magento.com/guides/v2.3/config-guide/config/config-php.html) for most it's configuration. This means that you need to add this array to your `app/etc/env.php`:

```
'sentry' => [
    'dsn' => 'example.com',
    'logrocket_key' => 'example/example',
    'environment' => null,
    'log_level' => \Monolog\Logger::WARNING,
    'errorexception_reporting' => E_ALL,
    'ignore_exceptions' => [],
    'mage_mode_development' => false,
    'js_sdk_version' => \JustBetter\Sentry\Block\SentryScript::CURRENT_VERSION,
    'tracing_enabled' => true,
    'tracing_sample_rate' => 0.5,
    'ignore_js_errors' => [],
    'disable_default_integrations' => [
        \Sentry\Integration\ModulesIntegration::class,
    ]
]

```

Next to that there are some configuration options under Stores &gt; Configuration &gt; JustBetter &gt; Sentry.

### Configuration values

[](#configuration-values)

- `dsn`: Please enter here the DSN you got from Sentry for your project. You can find the DSN in the project settings under "Client Key (DSN)"
- `environment`: Here you can specify the environment under which the deployed version is running. Common used environments are production, staging, and development. With this option you can differentiate between errors which happen on the staging and i.e. on the production system
- `log_level`: With this configuration you can specify from which logging level on Sentry should get the messages
- `errorexception_reporting`: If the Exception being thrown is an instance of [ErrorException](https://www.php.net/manual/en/class.errorexception.php) send the error to sentry if it matches the error reporting. This uses the same syntax as [Error Reporting](https://www.php.net/manual/en/function.error-reporting.php) eg. `E_ERROR | E_WARNING` to only log Errors and Warnings.
- `ignore_exceptions`: If the class being thrown matches any in this list do not send it to Sentry e.g. `[\Magento\Framework\Exception\NoSuchEntityException::class]`
- `mage_mode_development`: If this option is set to true you will receive issues in Sentry even if you're Magento is running in develop mode.
- `js_sdk_version`: if this option is set, it will load the explicit version of the javascript SDK of Sentry.
- `tracing_enabled` if this option is set to true, tracing got enabled (bundle file got loaded automatically). Default: `false`
- `tracing_sample_rate` if tracing is enabled, you should also set the sample rate. Default: `0.2`
- `ignore_js_errors` array of javascript error messages, which should be not send to Sentry. (see also `ignoreErrors` in [Sentry documentation](https://docs.sentry.io/clients/javascript/config/))
- `disable_default_integrations` provide a list of FQCN of default integrations, which you do not want to use. [List of default integrations](https://github.com/getsentry/sentry-php/tree/master/src/Integration). Default: `[]`

### Configuration for Adobe Cloud

[](#configuration-for-adobe-cloud)

Since Adobe Cloud doesn't allow you to add manually add content to the `env.php` file, the configuration can be done using the "Variables" in Adobe Commerce using the following variables:

- `CONFIG__SENTRY__ENVIRONMENT__ENABLED`: boolean
- `CONFIG__SENTRY__ENVIRONMENT__DSN`: string
- `CONFIG__SENTRY__ENVIRONMENT__LOGROCKET_KEY`: string
- `CONFIG__SENTRY__ENVIRONMENT__ENVIRONMENT`: string
- `CONFIG__SENTRY__ENVIRONMENT__LOG_LEVEL`: integer
- `CONFIG__SENTRY__ENVIRONMENT__ERROREXCEPTION_REPORTING`: integer
- `CONFIG__SENTRY__ENVIRONMENT__IGNORE_EXCEPTIONS`: A JSON encoded array of classes
- `CONFIG__SENTRY__ENVIRONMENT__MAGE_MODE_DEVELOPMENT`: string
- `CONFIG__SENTRY__ENVIRONMENT__JS_SDK_VERSION`: string
- `CONFIG__SENTRY__ENVIRONMENT__TRACING_ENABLED`: boolean
- `CONFIG__SENTRY__ENVIRONMENT__TRACING_SAMPLE_RATE`: float
- `CONFIG__SENTRY__ENVIRONMENT__IGNORE_JS_ERRORS`: A JSON encoded array of error messages

The following configuration settings can be overridden in the Magento admin. This is limited to ensure that changes to particular config settings can only be done on server level and can't be broken by changes in the admin.

Optional error page configuration
---------------------------------

[](#optional-error-page-configuration)

- Optional you can configure custom error pages in pub/errors. You can use the sentry feedback form and insert here the sentry log ID. The Sentry Log Id is captured in de customer session and can be retrieved in `processor.php`.

Sending additional data to Sentry when logging errors
-----------------------------------------------------

[](#sending-additional-data-to-sentry-when-logging-errors)

- When calling any function from the [Psr\\Log\\LoggerInterface](https://github.com/php-fig/log/blob/master/src/LoggerInterface.php) you can pass any data to the parameter $context and it will be send to Sentry as 'Custom context'.

Change / Filter events
----------------------

[](#change--filter-events)

This module has an event called `sentry_before_send` that is dispatched before setting the config [before\_send](https://docs.sentry.io/platforms/php/configuration/filtering/#using-platformidentifier-namebefore-send-). This provides the means to edit / filter events. You could for example add extra criteria to determine if the exception should be captured to Sentry. To prevent the Exception from being captured you can set the event to `null` or unset it completly.

```
public function execute(\Magento\Framework\Event\Observer $observer)
{
    $observer->getEvent()->getSentryEvent()->unsEvent();
}
```

Example:

Compatibility
-------------

[](#compatibility)

The module is tested on Magento version 2.4.x with sentry sdk version 3.x. feel free to fork this project or make a pull request.

Ideas, bugs or suggestions?
---------------------------

[](#ideas-bugs-or-suggestions)

Please create a [issue](https://github.com/justbetter/magento2-sentry/issues) or a [pull request](https://github.com/justbetter/magento2-sentry/pulls).

Contributing
------------

[](#contributing)

Contributing? Awesome! Thank you for your help improving the module!

- When making a PR please add a description what you've added, and if relevant why.
- To save time on codestyle feedback, please run
    - `composer install`
    - `composer run codestyle`
    - `composer run analyse`

About us
--------

[](#about-us)

We’re a innovative development agency from The Netherlands building awesome websites, webshops and web applications with Laravel and Magento. Check out our website [justbetter.nl](https://justbetter.nl) and our [open source projects](https://github.com/justbetter).

License
-------

[](#license)

[MIT](LICENSE)

---

[![JustBetter logo](https://raw.githubusercontent.com/justbetter/art/master/justbetter-logo.png)](https://justbetter.nl "JustBetter")

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance50

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

3

Last Release

389d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2f292f18954f550db6399f103ad4c67d3646026f4565940330ff1e8db66c976?d=identicon)[mostonski](/maintainers/mostonski)

---

Top Contributors

[![rakibabu](https://avatars.githubusercontent.com/u/14089150?v=4)](https://github.com/rakibabu "rakibabu (115 commits)")[![indykoning](https://avatars.githubusercontent.com/u/15870933?v=4)](https://github.com/indykoning "indykoning (67 commits)")[![royduin](https://avatars.githubusercontent.com/u/1703233?v=4)](https://github.com/royduin "royduin (16 commits)")[![VincentBean](https://avatars.githubusercontent.com/u/3906942?v=4)](https://github.com/VincentBean "VincentBean (13 commits)")[![peterjaap](https://avatars.githubusercontent.com/u/431360?v=4)](https://github.com/peterjaap "peterjaap (11 commits)")[![DominicWatts](https://avatars.githubusercontent.com/u/7295705?v=4)](https://github.com/DominicWatts "DominicWatts (10 commits)")[![rommelfreddy](https://avatars.githubusercontent.com/u/15031079?v=4)](https://github.com/rommelfreddy "rommelfreddy (6 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (5 commits)")[![michielgerritsen](https://avatars.githubusercontent.com/u/5858697?v=4)](https://github.com/michielgerritsen "michielgerritsen (4 commits)")[![JeroenBoersma](https://avatars.githubusercontent.com/u/1163348?v=4)](https://github.com/JeroenBoersma "JeroenBoersma (4 commits)")[![JKetelaar](https://avatars.githubusercontent.com/u/3681904?v=4)](https://github.com/JKetelaar "JKetelaar (4 commits)")[![XigenDominic](https://avatars.githubusercontent.com/u/6814203?v=4)](https://github.com/XigenDominic "XigenDominic (2 commits)")[![brosenberger](https://avatars.githubusercontent.com/u/2969243?v=4)](https://github.com/brosenberger "brosenberger (2 commits)")[![JosephMaxwell](https://avatars.githubusercontent.com/u/1151186?v=4)](https://github.com/JosephMaxwell "JosephMaxwell (2 commits)")[![kyriog](https://avatars.githubusercontent.com/u/629831?v=4)](https://github.com/kyriog "kyriog (2 commits)")[![matthiashamacher](https://avatars.githubusercontent.com/u/32356549?v=4)](https://github.com/matthiashamacher "matthiashamacher (2 commits)")[![moston](https://avatars.githubusercontent.com/u/2960288?v=4)](https://github.com/moston "moston (2 commits)")[![rbnmulder](https://avatars.githubusercontent.com/u/1227535?v=4)](https://github.com/rbnmulder "rbnmulder (2 commits)")[![jupiterlewis](https://avatars.githubusercontent.com/u/31236302?v=4)](https://github.com/jupiterlewis "jupiterlewis (1 commits)")[![fredden](https://avatars.githubusercontent.com/u/334786?v=4)](https://github.com/fredden "fredden (1 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/moston-magento2-sentry/health.svg)

```
[![Health](https://phpackages.com/badges/moston-magento2-sentry/health.svg)](https://phpackages.com/packages/moston-magento2-sentry)
```

###  Alternatives

[justbetter/magento2-sentry

Magento 2 Logger for Sentry

1851.5M3](/packages/justbetter-magento2-sentry)[dotdigital/dotdigital-magento2-extension

Dotdigital for Magento 2

50374.2k18](/packages/dotdigital-dotdigital-magento2-extension)[graycore/magento2-stdlogging

A Magento 2 module that changes all logging handlers to stdout

2382.6k](/packages/graycore-magento2-stdlogging)[corrivate/magento2-rest-api-logger

Advanced and convenient logging

2146.2k1](/packages/corrivate-magento2-rest-api-logger)[open-telemetry/opentelemetry-auto-wordpress

OpenTelemetry auto-instrumentation for Wordpress

17166.0k](/packages/open-telemetry-opentelemetry-auto-wordpress)[ampersand/magento2-log-correlation-id

Magento 2 correlation id for requests and logs

279.9k](/packages/ampersand-magento2-log-correlation-id)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
