PHPackages                             marchie/ms-application-insights-monolog - 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. marchie/ms-application-insights-monolog

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

marchie/ms-application-insights-monolog
=======================================

Microsoft Application Insights integration for monolog. An abstract handler that sends messages to Microsoft Application Insights

11.5k6PHP

Since Aug 5Pushed 10y agoCompare

[ Source](https://github.com/Marchie/ms-application-insights-monolog)[ Packagist](https://packagist.org/packages/marchie/ms-application-insights-monolog)[ RSS](/packages/marchie-ms-application-insights-monolog/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Microsoft Application Insights for Monolog
==========================================

[](#microsoft-application-insights-for-monolog)

Monolog Handler connection to [Microsoft Application Insights](http://azure.microsoft.com/en-gb/services/application-insights/)

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

[](#installation)

Via Composer: Add the following to your composer.json:

```
  "require": {
        "marchie/ms-application-insights-monolog": "dev-master"
    }
```

Usage
-----

[](#usage)

A handler is provided that wraps up a Microsoft Application Insights Telemetry client. By default the handler will grab anything at Logger::ERROR and above and send it to Microsoft Application Insights.

```
$logger  = new Monolog\Logger("Example");

$telemetryClient = new \ApplicationInsights\Telemetry_Client();
$telemetryClient->getContext()->setInstrumentationKey('YOUR INSTRUMENTATION KEY');

$msApplicationInsightsHandler = new \Marchie\MSApplicationInsightsMonolog\MSApplicationInsightsHandler($telemetryClient);

$logger->pushHandler($msApplicationInsightsHandler);

// The following error will get sent automatically to Microsoft Application Insights
$logger->addError("oh no!", array('exception' => new \Exception("ohnoception")));
```

Credits
-------

[](#credits)

This package is based on the [MonoSnag](https://github.com/meadsteve/MonoSnag) package. Thanks to Steve Brazier and other contributors to that package.

The package also relies on Microsoft's [ApplicationInsights-PHP](https://github.com/Microsoft/ApplicationInsights-PHP) package.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5711374?v=4)[Chris March](/maintainers/marchie)[@marchie](https://github.com/marchie)

### Embed Badge

![Health badge](/badges/marchie-ms-application-insights-monolog/health.svg)

```
[![Health](https://phpackages.com/badges/marchie-ms-application-insights-monolog/health.svg)](https://phpackages.com/packages/marchie-ms-application-insights-monolog)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B11.5k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1941.5M277](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2328.5M344](/packages/open-telemetry-sdk)

PHPackages © 2026

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