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

ActiveMagento2-module

webidea24/magento2-sentry
=========================

Magento 2 Logger for Sentry

103.5.0(3y ago)0230[1 PRs](https://github.com/webidea24/magento2-sentry/pulls)MITPHPPHP &gt;=7.0CI passing

Since Mar 7Pushed 5mo agoCompare

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

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

[ ![Package banner](./.github/assets/banner.svg)](https://github.com/justbetter/magento2-sentry "JustBetter")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 [Sentry](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 sent to sentry.

Features
--------

[](#features)

- Send exceptions and logs to Sentry
- Show detailed context on thrown exceptions (Like Magento user/api consumer id)
- Easily control which events get sent to Sentry
- Backend and frontend error reporting
- Performance sampling
- Cron Monitoring
- Session replay
- Logrocket support
- Sentry feedback form after an error

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\Level::Warning,
    'error_types' => E_ALL,
    'ignore_exceptions' => [],
    'mage_mode_development' => false,
    'js_sdk_version' => \JustBetter\Sentry\Block\SentryScript::CURRENT_VERSION,
    'tracing_enabled' => true,
    'traces_sample_rate' => 0.5,
    'disable_default_integrations' => [
        \Sentry\Integration\ModulesIntegration::class,
    ],
    'performance_tracking_enabled' => true,
    'performance_tracking_excluded_areas' => [\Magento\Framework\App\Area::AREA_ADMINHTML, \Magento\Framework\App\Area::AREA_CRONTAB],
    'profiles_sample_rate' => 0.5,
    'ignore_js_errors' => [],
    'enable_csp_report_url' => true,
]

```

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

### Configuration values

[](#configuration-values)

NameDefaultDescription`dsn`—The DSN you got from Sentry for your project. You can find the DSN in the project settings under "Client Key (DSN)"`release`the current deployed version in `deployed_version.txt`Specify the current release version. Example with dynamic git hash: `trim(exec('git --git-dir ' . BP . '/.git' . ' log --pretty="%h" -n1 HEAD'))``mage_mode_development``false`If set to true, you will receive issues in Sentry even if Magento is running in develop mode.`environment`—Specify the environment under which the deployed version is running. Common values: production, staging, development. Helps differentiate errors between environments.`max_breadcrumbs``100`This variable controls the total amount of breadcrumbs that should be captured.`attach_stacktrace``false`When enabled, stack traces are automatically attached to all messages logged. Even if they are not exceptions.`prefixes`\[[BP](https://github.com/magento/magento2/blob/9a62604c5a7ab70db1386d307b0dbfe596611102/app/autoload.php#L16)\]A list of prefixes that should be stripped from the filenames of captured stacktraces to make them relative.`sample_rate``1.0`Configures the sample rate for error events, in the range of 0.0 to 1.0.`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]``error_types``E_ALL`If the Exception 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. Uses the same syntax as [Error Reporting](https://www.php.net/manual/en/function.error-reporting.php), e.g., `E_ERROR``log_level``\Monolog\Level::Warning`Specify from which logging level on Sentry should get the [messages](https://docs.sentry.io/platforms/php/usage/#capturing-messages).`clean_stacktrace``true`Whether unnecessary files (like Interceptor.php, Proxy.php, and Factory.php) should be removed from the stacktrace. (They will not be removed if they threw the error.)`tracing_enabled``false`If set to true, tracing is enabled (bundle file is loaded automatically).`traces_sample_rate``0.2`If tracing is enabled, set the sample rate. A number between 0 and 1, controlling the percentage chance a given transaction will be sent to Sentry.`traces_sample_rate_cli`The value of `traces_sample_rate`If tracing is enabled, set the sample rate for CLI. A number between 0 and 1, controlling the percentage chance a given transaction will be sent to Sentry.`profiles_sample_rate``0` (disabled)if this option is larger than 0 (zero), the module will create a profile of the request. Please note that you have to install [Excimer](https://www.mediawiki.org/wiki/Excimer) on your server to use profiling. [Sentry documentation](https://docs.sentry.io/platforms/php/profiling/). You have to enable tracing too.`performance_tracking_enabled``false`if performance tracking is enabled, a performance report gets generated for the request.`performance_tracking_excluded_areas``['adminhtml', 'crontab']`if `performance_tracking_enabled` is enabled, we recommend to exclude the `adminhtml` &amp; `crontab` area.`enable_logs``false`This option enables the [logging integration](https://sentry.io/product/logs/), which allows the SDK to capture logs and send them to Sentry.`logger_log_level``\Monolog\Level::Notice`If the logging integration is enabled, specify from which logging level the logger should log`js_sdk_version``\JustBetter\Sentry\Block\SentryScript::CURRENT_VERSION`If set, loads the explicit version of the JavaScript SDK of Sentry.`ignore_js_errors``[]`Array of JavaScript error messages which should not be sent 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 you do not want to use. [List of default integrations](https://github.com/getsentry/sentry-php/tree/master/src/Integration).`cron_monitoring_enabled``false`Wether to enable [cron check ins](https://docs.sentry.io/platforms/php/crons/#upserting-cron-monitors)`track_crons``[]`Cron handles of crons to track with cron monitoring, [Sentry only supports 6 check-ins per minute](https://docs.sentry.io/platforms/php/crons/#rate-limits) Magento does many more.`spotlight``false`Enable [Spotlight](https://spotlightjs.com/) on the page`spotlight_url`-Override the [Sidecar url](https://spotlightjs.com/sidecar/)`enable_csp_report_url``false`If set to true, the report-uri will be automatically added based on the DSN.### 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:

NameType`CONFIG__SENTRY__ENVIRONMENT__ENABLED`boolean`CONFIG__SENTRY__ENVIRONMENT__DSN`string`CONFIG__SENTRY__ENVIRONMENT__MAGE_MODE_DEVELOPMENT`string`CONFIG__SENTRY__ENVIRONMENT__ENVIRONMENT`string`CONFIG__SENTRY__ENVIRONMENT__MAX_BREADCRUMBS`integer`CONFIG__SENTRY__ENVIRONMENT__ATTACH_STACKTRACE`boolean`CONFIG__SENTRY__ENVIRONMENT__SAMPLE_RATE`float`CONFIG__SENTRY__ENVIRONMENT__IGNORE_EXCEPTIONS`JSON array of classes`CONFIG__SENTRY__ENVIRONMENT__ERROR_TYPES`integer`CONFIG__SENTRY__ENVIRONMENT__LOG_LEVEL`integer`CONFIG__SENTRY__ENVIRONMENT__CLEAN_STACKTRACE`boolean`CONFIG__SENTRY__ENVIRONMENT__TRACING_ENABLED`boolean`CONFIG__SENTRY__ENVIRONMENT__TRACES_SAMPLE_RATE`float`CONFIG__SENTRY__ENVIRONMENT__PROFILES_SAMPLE_RATE`float`CONFIG__SENTRY__ENVIRONMENT__PERFORMANCE_TRACKING_ENABLED`boolean`CONFIG__SENTRY__ENVIRONMENT__PERFORMANCE_TRACKING_EXCLUDED_AREAS`boolean`CONFIG__SENTRY__ENVIRONMENT__ENABLE_LOGS`boolean`CONFIG__SENTRY__ENVIRONMENT__LOGGER_LOG_LEVEL`boolean`CONFIG__SENTRY__ENVIRONMENT__JS_SDK_VERSION`string`CONFIG__SENTRY__ENVIRONMENT__IGNORE_JS_ERRORS`JSON array of error messagesThe 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.

Please note, that it is not possible to use profiling within the Adobe Cloud.

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:

This same thing is the case for

sentry\_before\_send[https://docs.sentry.io/platforms/php/configuration/options/#before\_send](https://docs.sentry.io/platforms/php/configuration/options/#before_send)sentry\_before\_send\_transaction[https://docs.sentry.io/platforms/php/configuration/options/#before\_send\_transaction](https://docs.sentry.io/platforms/php/configuration/options/#before_send_transaction)sentry\_before\_send\_check\_in[https://docs.sentry.io/platforms/php/configuration/options/#before\_send\_check\_in](https://docs.sentry.io/platforms/php/configuration/options/#before_send_check_in)sentry\_before\_breadcrumb[https://docs.sentry.io/platforms/php/configuration/options/#before\_breadcrumb](https://docs.sentry.io/platforms/php/configuration/options/#before_breadcrumb)sentry\_before\_send\_log[https://docs.sentry.io/platforms/php/configuration/options/#before\_send\_log](https://docs.sentry.io/platforms/php/configuration/options/#before_send_log)Compatibility
-------------

[](#compatibility)

The module is tested on Magento version 2.4.x with sentry sdk version 4.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!

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Most importantly:

- 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`

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

[ ![We’re a innovative development agency from The Netherlands.](./.github/assets/footer.svg)](https://justbetter.nl "JustBetter")

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance50

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity73

Established project with proven stability

 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 ~44 days

Recently: every ~39 days

Total

64

Last Release

164d ago

Major Versions

0.8.0 → 2.0.02019-11-19

2.6.1 → 3.0.02022-04-13

3.2.0 → 103.3.02022-09-20

3.9.0 → 4.0.02025-04-23

PHP version history (2 changes)0.0.5PHP &gt;=7.0

3.6.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5a90bcfb9daf0fd7cb93ef1449e706f86ef33f0ad304f5305aa395b59da70e75?d=identicon)[webidea](/maintainers/webidea)

---

Top Contributors

[![indykoning](https://avatars.githubusercontent.com/u/15870933?v=4)](https://github.com/indykoning "indykoning (117 commits)")[![rakibabu](https://avatars.githubusercontent.com/u/14089150?v=4)](https://github.com/rakibabu "rakibabu (115 commits)")[![royduin](https://avatars.githubusercontent.com/u/1703233?v=4)](https://github.com/royduin "royduin (20 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)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (9 commits)")[![rommelfreddy](https://avatars.githubusercontent.com/u/15031079?v=4)](https://github.com/rommelfreddy "rommelfreddy (9 commits)")[![claudio-ferraro](https://avatars.githubusercontent.com/u/54107647?v=4)](https://github.com/claudio-ferraro "claudio-ferraro (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)")[![michielgerritsen](https://avatars.githubusercontent.com/u/5858697?v=4)](https://github.com/michielgerritsen "michielgerritsen (4 commits)")[![brosenberger](https://avatars.githubusercontent.com/u/2969243?v=4)](https://github.com/brosenberger "brosenberger (3 commits)")[![XigenDominic](https://avatars.githubusercontent.com/u/6814203?v=4)](https://github.com/XigenDominic "XigenDominic (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)")[![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)")

### Embed Badge

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

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

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[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)

PHPackages © 2026

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