Skip to content

A Laravel package for log queries in user defined log channel. Your all queries will save in the log file, and you can view it anytime.

License

Notifications You must be signed in to change notification settings

dipenparmar12/laravel-query-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Query Log

Latest Version on Packagist Total Downloads

A Laravel package for log queries in user defined log channel. Your all queries will save in the log file, and you can view it anytime.

Installation

Install the package via composer:

composer require dipenparmar12/laravel-query-log

Note: Make sure this package used only in development environment, Otherwise may you face decreased performance in production.

Optionally, you can publish the config file of this package with this command:

php artisan vendor:publish --provider="Dipenparmar12\QueryLog\StoreQueryLogServiceProvider" --tag="config"

The following config file will be published in config/querylog.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default Log Channels
    |--------------------------------------------------------------------------
    |
    | Here you may configure the log channels for query log.
    | This option defines the default log channel that gets used when writing
    | Query to the logs. The name specified in this option should match
    | one of the channels defined in the  `config/logging.php` "channels" configuration array.
    | You can define multiple channels seprated by comman (,) for query log.
    | 
    */

    'log_chhanels' =>  env('QUERY_LOG_CHHANELS', null),

    /*
    |--------------------------------------------------------------------------
    | To disable or enable the general query log.
    |--------------------------------------------------------------------------
    |
    | This option use to disable or enable the general query log,
    | Out of the box, Laravel uses the Monolog PHP logging library. 
    | This gives you a variety of powerful log handlers / formatters 
    | to utilize.
    |
    */

    'query_log_enable' => env('QUERY_LOG_ENABLE', true),

];

Usage

If you want to disable query log completely. change the following in .env file

QUERY_LOG_ENABLE=false

If we want to use query logging in multiple log channels, we can archive it by following .env

QUERY_LOG_CHHANELS='single,daily'

Note: Make sure the name specified in this option should match one of the channels defined in the config/logging.php channels configuration array.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

A Laravel package for log queries in user defined log channel. Your all queries will save in the log file, and you can view it anytime.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages