bri4n0 / sql-query-log
Output Laravel SQL query log.
1.0.3
2024-06-01 11:13 UTC
Requires
- php: ^7.4|^8.0
- illuminate/support: ^v8.0.0|^v9.0.0|^v10.0.0|^11.0.0
README
Install
To install via Composer, run:
composer require bri4n0/sql-query-log
For version <= 11: Add to section providers of config/app.php:
// config/app.php 'providers' => [ ... Bri4n0\SqlQueryLog\DataBaseQueryServiceProvider::class, ];
For version >= 11: Add to section providers of bootstrap/providers.php:
// bootstrap/providers.php return [ ... Bri4n0\SqlQueryLog\DataBaseQueryServiceProvider::class, ];
Set enable SQL query log, Add to .env
:
ENABLE_SQL_LOG=true
Others
Custom logging channel:
- open file config/logging.php
- add channel to section channels:
'channels' => [ ..., 'sql-query-log' => [ 'driver' => 'daily', 'path' => storage_path('logs/queries.log'), 'days' => env('LOG_DAILY_DAYS', 14), 'replace_placeholders' => true, ], ]
- enable using sql query log channel:
SQL_LOG_CHANNEL=sql-query-log
Custom logging channel level:
SQL_LOG_LEVEL=debug
License
MIT © Bri4n0