mnabialek / laravel-sql-logger

Log SQL queries for Laravel/Lumen framework
MIT License
156 stars 24 forks source link

lumen 5.7 not work #18

Closed mowangjuanzi closed 5 years ago

mowangjuanzi commented 5 years ago

I followed the tutorial to register for service providers

$app->register(Mnabialek\LaravelSqlLogger\Providers\ServiceProvider::class);

I found that the component didn't work properly

The reason is that lumen does not automatically register the event object

So if you change the registration code to the following:

$app["db"]->connection()->setEventDispatcher($app["events"]);
$app->register(Mnabialek\LaravelSqlLogger\Providers\ServiceProvider::class);

Lumen v5.8 is untested.

So I created issus just to provide a solution. After looking for a long time before looking for a solution, I did not find the one I wanted after looking for the source code.

mnabialek commented 5 years ago

Thank you for report. I will try to investigate this issue.

mowangjuanzi commented 5 years ago

got it

mnabialek commented 5 years ago

@mowangjuanzi I've tested it in Lumen 5.8 and in fact queries were not logged. I've made a change and just released 2.2.2 version and it should work now. Please verify and confirm it's fine now.

mowangjuanzi commented 5 years ago

@mnabialek Perfect. It works.