Created
September 8, 2021 06:26
-
-
Save nuryagdym/4f9ade8ceabad674debc08fedafffb62 to your computer and use it in GitHub Desktop.
Laravel Lumen v5.4 Monolog Logger (Graylog Gelf logger) integration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//bootstrap/app.php: | |
//... | |
$app->configureMonologUsing(function ($monolog) use ($app) { | |
$publisher = new \Gelf\Publisher(new \Gelf\Transport\HttpTransport(env('GRAYLOG_HOST'), env('GRAYLOG_PORT'), env('GRAYLOG_PATH'))); | |
$failureHandler = new \Monolog\Handler\WhatFailureGroupHandler([new \Monolog\Handler\GelfHandler($publisher)]); | |
$monolog->pushHandler($failureHandler); | |
//fixes error: A facade root has not been set | |
return $monolog; | |
}); | |
//... | |
return $app; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment