mnabialek / laravel-sql-logger

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

Possibility to get sql logs in standard laravel log files #14

Closed Okipa closed 6 years ago

Okipa commented 6 years ago

Hi @mnabialek,

Thanks for your package that I just found and seems to be great and well tested !

After installing your package and reading the doc, I noticed that there is currently no way to choose if we want the SQL logs in a dedicated directory or written in the standard laravel log file(s => according to the single or daily configuration). It seems that right now, we only can set the location of the directory for the dedicated SQL log files.

Also, would it be possible to add the possibility for developers to get the SQL logs directly in the standard log files instead of dedicated log files ?

mnabialek commented 6 years ago

Hello @Okipa

Can you please tell me what is the use case for this? This package is in fact intended for development so I think it's much more convenient to have SQL logs separated from Laravel log.

You can for example log all the queries but when you have an app error you can go to Laravel log and you don't have in there a lot of SQL lines that you don't care at this moment.

Also about log files you can adjust:

SQL_LOGGER_ALL_QUERIES_FILE_NAME="[Y-m-d]-log"

env variable. So you can log each day into separate file or you can put all SQL logs into single file.

Okipa commented 6 years ago

Yes you're right, the package setup can fit for a lot of developers needs right now. I asked this because it can be annoying to follow several log files at the same time. I'm personally used to tail -f one file to get http, sql and laravel logs at the same time and I think there are other developers who would prefer to work this way too. Would consider to provide this option to enable developers to choose where the logs are included ?

mnabialek commented 6 years ago

I think at the moment it would be hard to achieve as some options are not compatible and might cause clearing of the whole Laravel log so it could be quite risky. But maybe in future I will reconsider this as an option.