PHPackages                             emarketa/advanced-logger-magento2 - 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. emarketa/advanced-logger-magento2

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

emarketa/advanced-logger-magento2
=================================

Magento 2 module. Sends logs to Elasticsearch or Datadog.

0.4.0(4y ago)91.2k2[1 issues](https://github.com/emarketa/advanced-logger-magento2/issues)GPL-3.0PHPPHP &gt;=7.4.0

Since Apr 11Pushed 4y ago1 watchersCompare

[ Source](https://github.com/emarketa/advanced-logger-magento2)[ Packagist](https://packagist.org/packages/emarketa/advanced-logger-magento2)[ Docs](https://github.com/emarketa/advanced-logger-magento2)[ RSS](/packages/emarketa-advanced-logger-magento2/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Emarketa Advanced Logger
========================

[](#emarketa-advanced-logger)

### Version 0.4.0 (Beta) A module to send your Magento 2 logs to an Elasticsearch server or to Datadog.

[](#version-040-beta-a-module-to-send-your-magento-2-logs-to-an-elasticsearch-server-or-to-datadog)

This module was born from a need to centralise logs from multiple web nodes running a Magento 2 site. It currently has 3 solutions for sending logs to an external service for consumption and will capture just about everything the Monolog logger (which comes with Magento 2) handles.

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

[](#installation)

Install or upgrade via Composer with the command:

`composer require emarketa/advanced-logger-magento2`.

*Requires Magento 2 and PHP 7.0 or above.*

Elasticsearch Logger
--------------------

[](#elasticsearch-logger)

Configuration is available within the Magento 2 admin via **STORES** &gt; **Configuration** &gt; **EMARKETA** &gt; **Advanced Logger** &gt; *Elasticsearch*.

### Configuration options:

[](#configuration-options)

- **Enable Elasticsearch Logger:** Here you can enable logging to Elasticsearch server/s specified in the *Hosts* configuration.
- **Enabled in Developer Mode:** As developer mode creates a lot of log records, this may not be something you want to have enabled all the time (if ever) so it is disabled by default just in case you refresh your local development database from a copy of production and forget to disable this feature. However, the option is here if you need to override it.
- **Minimum Level:** This is set to *WARNING* by default to prevent a situation where Magento 2 debug logs causes a flood of log records to turn up in your Elasticsearch server. Lower the level with caution.
- **Index Label Suffix:** When creating a new index to log to, Advanced Logger will attempt to create an index named `magento_log_[SUFFIX]`. If left blank, the index name will imaginatively default to the word `default` creating the index name `magento_log_default`. You have the opportunity here to have separate index names for different sites or even different store views in Magento 2.

#### Connection

[](#connection)

- **Hosts:** Here you can specify the hosts passed to the Elasticsearch PHP module (). A comma separated list (avoid spaces here) will set-up multiple hosts. Your entry should conform to the following format: `host:port,host:port.` User names and passwords would also be included in the hosts for HTTP Auth.

> Examples:
>
> For HTTP Auth use the following format: `http://user:pass@1.2.3.4:9200`
>
> For SSL the following format: `https://1.2.3.4:9200`
>
> If you need to specify a certificate file, then please add this via the command line like so:
>
> `bin/magento config:set advanced_logger/elasticsearch/cafile /full/path/to/ca.pem`.
>
> This will be passed on to the `elastic/elasticsearch-php` module but please note, secure connections to Elasticsearch are not yet fully tested within the context of this module.

Datadog Logger
--------------

[](#datadog-logger)

Configuration is available within the Magento 2 admin via **STORES** &gt; **Configuration** &gt; **EMARKETA** &gt; **Advanced Logger** &gt; *Datadog*.

You have 2 ways to send logs to Datadog:

### Via the Datadog Agent (preferred).

[](#via-the-datadog-agent-preferred)

- **Enabled:** Again, this is to enable writing logs a json formatted file for the Datadog Agent to consume. See here for instructions on installing and setting up the agent: [https://docs.datadoghq.com/getting\_started/agent/?tab=datadogussite](https://docs.datadoghq.com/getting_started/agent/?tab=datadogussite)

> TIPS: You will need to configure the path to point to `/path/to/your/magento/var/log/datadog.log.json`
>
> In your Datadog's PHP configuration file, you would have something like this:
>
> ```
> init_config:
>
> instances:
>
> ## Log section
> logs:
>
>   - type: file
>     path: "/path/to/your/magento/var/log/datadog.log.json"
>     service: php
>     source: php
>     sourcecategory: sourcecode
> ```
>
>
>
> *You can add your own tags in this file too.*
>
> Warning: If you enable HTTP API and the agent method at the same time, and, have a running Datadog agent linked to the same account as your API key, you will get every log twice in your account.

- **Enabled in Developer Mode:** As developer mode creates a lot of log records, this may not be something you want to have enabled all the time (if ever) so it is disabled by default just in case you refresh your local development database from a copy of production and forget to disable this feature. However, the option is here if you need to override it.
- **Minimum Level:** This is set to *WARNING* by default to prevent a situation where Magento 2 debug logs causes a flood of log records to turn up in your Datadog account driving up the cost of storage. Lower the level with caution.

### Via HTTP API

[](#via-http-api)

- **Send via Cron:** If you're unable to set up the Datadog agent on your host but you don't want to block the site in any way when sending logs, you can now use this feature to send logs every minute as part of the Magento cron. Note that this means there's up to a minute delay between the even and when the log is sent to Datadog. The cron will clear the file after each successful send to keep the request sizes to a minimum.
- **Send Logs Individually:** Because PHP is a blocking language and because PHP Curl hangs until it receives a response, you might be trading off the convenience of not having to set-up the Datadog agent with site performance. You could mitigate this issue further by raising the minimum level to *ERROR*. If debug logs are active and being sent to Datadog, even with the 120 ms time-out, you may experience substantial hangs on levels lower than *WARNING*.

> TIP: Really, this solution is probably most useful when you want to have some temporary insight into problems with a production cluster of web nodes or you may have it enabled on a staging environment to help audit a release.
>
> If you do have HTTP enabled permanently, then please note that you should keep the minimum log level set to *WARNING* or above and that all failed attempts to send a record fail silently.
>
> Warning: If you enable http and agent methods at the same time, and, have a running Datadog agent linked to the same account, you will get every log twice in your account.

- **Enabled in Developer Mode:** It's advised you do not enable this in developer mode as you will be charged for the storage and the with so much logging activity you will slow things down as PHP waits for every call to curl. But if you really must enable HTTP in developer mode then here's the option to do that. It is disabled by default just in case you refresh your local development database from a copy of production and forget to disable this feature.
- **Minimum Level:** Setting below level *WARNING* could potentially create a large amount of records which could substantially increase your costs; especially if debug logs are being created.
- **Account Region:** Specify your account region. If unsure, log into your dashboard and look to see if you are at `https://app.datadoghq.eu/` or `https://app.datadoghq.com/`.
- **API Key:** You need to get this right because there is currently no way of knowing (due to a policy of fire and forget) if it's failing other than waiting seconds or so to see if a log appears.

> For EU accounts your API keys are available here:
>
> For US accounts your API keys are available here:

Licence
-------

[](#licence)

Released under the GNU GENERAL PUBLIC LICENSE Version 3. Please remember to accredit usage.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Total

2

Last Release

1629d ago

PHP version history (2 changes)0.3.0PHP &gt;=7.0.0

0.4.0PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/86a2ca88abecec42ba01c9719203ab968c7339f63074d35f99d06a8a8574c1d0?d=identicon)[emarketa](/maintainers/emarketa)

---

Top Contributors

[![emarketa](https://avatars.githubusercontent.com/u/49675802?v=4)](https://github.com/emarketa "emarketa (4 commits)")

---

Tags

DataDogelasticsearchexceptionmagentologgercomposer-installermagento 2Elastic StackEmarketa

### Embed Badge

![Health badge](/badges/emarketa-advanced-logger-magento2/health.svg)

```
[![Health](https://phpackages.com/badges/emarketa-advanced-logger-magento2/health.svg)](https://phpackages.com/packages/emarketa-advanced-logger-magento2)
```

###  Alternatives

[justbetter/magento2-sentry

Magento 2 Logger for Sentry

1861.5M3](/packages/justbetter-magento2-sentry)[yireo/magento2-whoops

Magento 2 module adding Whoops error handling

102739.7k](/packages/yireo-magento2-whoops)[yireo/magento2-webp2

Magento 2 module to add WebP support to the Magento frontend

2111.3M7](/packages/yireo-magento2-webp2)[guanguans/laravel-exception-notify

Monitor exception and report to the notification channels(Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

14844.4k1](/packages/guanguans-laravel-exception-notify)[betterde/logger

Elasticsearch logger handler

3131.1k](/packages/betterde-logger)[yireo/magento2-newrelic2

Add NewRelic JS support and PHP tracking to Magento

1515.0k](/packages/yireo-magento2-newrelic2)

PHPackages © 2026

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