2017 © Pedro Peláez
 

library laravel-sql-logger

A tool to log all queries for laravel/lumen application.

image

feyman/laravel-sql-logger

A tool to log all queries for laravel/lumen application.

  • Friday, February 2, 2018
  • by Feyman
  • Repository
  • 2 Watchers
  • 1 Stars
  • 330 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 6 Versions
  • 53 % Grown

The README.md

Laravel Sql Logger

:pencil: This package allows you to log SQL queries (and slow SQL queries) to log file in Laravel/Lumen framework. Inspiration form mnabialek/laravel-sql-logger, (*1)

Installation

composer require feyman/laravel-sql-logger --dev

Please keep the --dev option. (it's recommended to use this package only for development). The Logger will be enabled when APP_DEBUG is true, (*2)

Configuration

If you use Laravel < 5.5 open app/Providers/AppServiceProvider.php and in register method add:, (*3)

public function register()
{
    if ($this->app['config']->get('app.debug')) {
        $this->app->register(\Feyman\LaravelSqlLogger\Providers\ServiceProvider::class);
    }
}

Laravel 5.5 uses Package Auto-Discovery and it will automatically load this service provider so you don't need to add anything into above file., (*4)

If you are using Lumen open bootstrap/app.php and add:, (*5)

if (env('APP_DEBUG')) {
    $app->register(\Feyman\LaravelSqlLogger\Providers\LumenServiceProvider::class);
}

If you use Laravel < 5.5 run:, (*6)

php artisan vendor:publish --provider="Feyman\LaravelSqlLogger\Providers\ServiceProvider"

in your console to publish default configuration files., (*7)

If you are using Laravel 5.5 run:

php artisan vendor:publish

and choose the number matching "Feyman\LaravelSqlLogger\Providers\ServiceProvider" provider. This operation will create config file in config/sql_loger.php. By default you should not edit published file because all the settings are loaded from .env file by default., (*8)

For Lumen you should skip this step., (*9)

In your .env file add the following entries:

# Whether all SQL queries should be logged
SQL_LOG_QUERIES=true 

# Whether slow SQL queries should be logged (you can log all queries and
# also slow queries in separate file or you might to want log only slow queries)
SQL_LOG_SLOW_QUERIES=true

# Time of query (in milliseconds) when this query is considered as slow
SQL_SLOW_QUERIES_MIN_EXEC_TIME=100

#Whether slow SQL queries should be logged (you can log all queries and
#also slow queries in separate file or you might to want log only slow queries)
SQL_LOG_OVERRIDE=false

# Directory where log files will be saved
SQL_LOG_DIRECTORY=logs/sql

# Whether execution time in log file should be displayed in seconds(by default it's in milliseconds)
SQL_CONVERT_TIME_TO_SECONDS=false

# Whether artisan queries should be logged to separate files
SQL_LOG_SEPARATE_ARTISAN=false

License

MIT, (*10)

The Versions

02/02 2018

dev-master

9999999-dev

A tool to log all queries for laravel/lumen application.

  Sources   Download

MIT

The Requires

 

by Avatar Feyman

query logger laravel sql logger laravel query logger laravel-sql-logger query-logger lumen-query-logger log-query

02/02 2018

0.0.5

0.0.5.0

A tool to log all queries for laravel/lumen application.

  Sources   Download

MIT

The Requires

 

by Avatar Feyman

laravel-sql-logger query-logger lumen-query-logger log-query

24/01 2018

0.0.4

0.0.4.0

A tool to log all queries for laravel/lumen application.

  Sources   Download

MIT

The Requires

 

by Avatar Feyman

laravel-sql-logger query-logger lumen-query-logger log-query

12/01 2018

0.0.3

0.0.3.0

A tool to log all queries for laravel/lumen application.

  Sources   Download

MIT

The Requires

 

by Avatar Feyman

laravel-sql-logger query-logger lumen-query-logger log-query

24/12 2017

0.0.2

0.0.2.0

A tool to log all queries for laravel/lumen application.

  Sources   Download

MIT

The Requires

 

by Avatar Feyman

query logger laravel sql logger laravel query logger

24/12 2017

0.0.1

0.0.1.0

A tool to log all queries for laravel/lumen application.

  Sources   Download

MIT

The Requires

 

by Avatar Feyman

query logger laravel sql logger laravel query logger