hedii / laravel-gelf-logger

A package to send gelf logs to a gelf compatible backend like graylog
MIT License
125 stars 33 forks source link

README.md update #47

Closed yli-bt closed 1 year ago

yli-bt commented 1 year ago

It looks like the conf/logging.php causes errors when used in lumen 1.0.

When adding 'gelf' to the 'stack' logs, I observe the following errors, causing Monolog to automatically fall back to default laravel logging.

[2023-08-14 15:08:26] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): PsrLogMessageProcessor must be an instance of Monolog\\Processor\\ProcessorInterface at /home/yli/work/service-search-index/vendor/illuminate/log/LogManager.php:393)
[stacktrace]
#0 /home/yli/work/service-search-index/vendor/illuminate/collections/Traits/EnumeratesValues.php(236): Illuminate\\Log\\LogManager->Illuminate\\Log\\{closure}()
#1 /home/yli/work/service-search-index/vendor/illuminate/log/LogManager.php(389): Illuminate\\Support\\Collection->each()
#2 /home/yli/work/service-search-index/vendor/illuminate/log/LogManager.php(222): Illuminate\\Log\\LogManager->createMonologDriver()
#3 /home/yli/work/service-search-index/vendor/illuminate/log/LogManager.php(137): Illuminate\\Log\\LogManager->resolve()
#4 /home/yli/work/service-search-index/vendor/illuminate/log/LogManager.php(124): Illuminate\\Log\\LogManager->get()
#5 /home/yli/work/service-search-index/vendor/illuminate/log/LogManager.php(113): Illuminate\\Log\\LogManager->driver()
#6 /home/yli/work/service-search-index/vendor/illuminate/support/Facades/Facade.php(353): Illuminate\\Log\\LogManager->channel()
#7 /home/yli/work/service-search-index/routes/web.php(21): Illuminate\\Support\\Facades\\Facade::__callStatic()
#8 /home/yli/work/service-search-index/vendor/illuminate/container/BoundMethod.php(36): Closure->{closure}()
#9 /home/yli/work/service-search-index/vendor/illuminate/container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#10 /home/yli/work/service-search-index/vendor/illuminate/container/BoundMethod.php(81): Illuminate\\Container\\Util::unwrapIfClosure()
#11 /home/yli/work/service-search-index/vendor/illuminate/container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#12 /home/yli/work/service-search-index/vendor/illuminate/container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#13 /home/yli/work/service-search-index/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(304): Illuminate\\Container\\Container->call()
#14 /home/yli/work/service-search-index/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(269): Laravel\\Lumen\\Application->callActionOnArrayBasedRoute()
#15 /home/yli/work/service-search-index/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(171): Laravel\\Lumen\\Application->handleFoundRoute()
#16 /home/yli/work/service-search-index/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(431): Laravel\\Lumen\\Application->Laravel\\Lumen\\Concerns\\{closure}()
#17 /home/yli/work/service-search-index/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(167): Laravel\\Lumen\\Application->sendThroughPipeline()
#18 /home/yli/work/service-search-index/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(112): Laravel\\Lumen\\Application->dispatch()
#19 /home/yli/work/service-search-index/public/index.php(28): Laravel\\Lumen\\Application->run()
#20 {main}
"} 

Removing the 'processors' block inside the 'gelf' config appears to clear this error. I'm not an expert but it appears that your Processor classes are not implementing the right interface for Monolog to be happy.

hedii commented 1 year ago

Hi,

I am adding the processor interface to the package optional processors .

But I think your error has nothing to do with the processors included in this package. Your error is related to PsrLogMessageProcessor included in monolog.

I am not using Lumen, and I have designed this package for Laravel.

If it works with Lumen, great, if it does not, i need help from Lumen users to submit pull requests.

Also, are you really using version 1.0 of Lumen or is it a typo?