huang-yi/laravel-db-log

Logs database queries for Laravel.


Keywords
log, database, sql, laravel
License
MIT

Documentation

Laravel DB Log

License Build Status

This package logs your database queries.

Version Compatibility

Laravel Laravel-DB-Log
<=5.5 1.5
5.6 1.6

Installation

$ composer require huang-yi/laravel-db-log:1.6.*

Usage

Add this configuration to your application's .env file:

DB_LOG=true

Configuration

In general, developers do not need to modify any configurations.

If you don't want to keep the default configurations, just copy the following options into the config/logging.php file:

<?php

return [
    'channels' => [
        'db' => [
            'debug' => env('DB_LOG', false),
            'name' => env('DB_LOG_NAME', 'sql'),
            'driver' => env('DB_LOG_DRIVER', 'daily'),
            'path' => storage_path('logs/sql.log'),
            'level' => env('DB_LOG_LEVEL', 'debug'),
            'days' => env('DB_LOG_MAX_FILES', 2),
        ],
    ],
];

Chinese Doc

中文文档

License

The Laravel DB Log package is open-sourced software licensed under the MIT license.