PHPackages                             golin/monologgly - 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. golin/monologgly

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

golin/monologgly
================

Loggly helpers for php

v1.0.4(9y ago)17.5k1MITPHP

Since Apr 4Pushed 9y ago7 watchersCompare

[ Source](https://github.com/golincode/monologgly)[ Packagist](https://packagist.org/packages/golin/monologgly)[ RSS](/packages/golin-monologgly/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (2)Versions (7)Used By (0)

Loggly Helpers
==============

[](#loggly-helpers)

This extends the basic loggly handler provided by monolog, adding the following information as context:

- the environment
- whether the log happened on a request, or CLI call
- information about the http request (url, method)
- information about the origin of the log call (file and line, class and method (if relevant))
- some simplified exception information (if the log comes from a "normal" exception log - ie. logging, or `__toString`-ing the exception)

Note: there is currently a bug with the class and method origin / backtrace information.

### Installation

[](#installation)

```
composer require golin/monologgly
```

### Exceptions

[](#exceptions)

To log exception information, simply add the exception to the context:

```
$logger->debug('Oh No!', ['exception' => $e]);
```

The exception object will be removed before final logging, and replaced with an array interpretation of it. It will still be available to all other processors added (as long as they are added before the exception information processor (which they will be using the provided service provider)).

### Setup with Laravel

[](#setup-with-laravel)

##### Config

[](#config)

Add the following to `config/app.php`:

```
    'loggly-token' => env('LOGGLY_TOKEN'),
```

and add your loggly token to your .env file. Ommitting this will mean that the loggly monlog handler will not be loaded (and nothing will be sent to loggly) - basically, it's safe to not have this key when developing locally.

##### Provider

[](#provider)

Add the following file, as `LogglyServiceProvider.php`, and put it in your application's service providers config in `config/app.php`.

Update the `$name` property with your application's name.

```
