klaravel/db-logger
Composer 安装命令:
composer require klaravel/db-logger
包简介
Laravel database/sql queries logger.
README 文档
README
This module allows you to log SQL queries (and slow SQL queries) to log file in Laravel framework. It's useful mainly when developing your application to verify whether your queries are valid and to make sure your application doesn't run too many or too slow database queries.
Installation:
-
Run
composer require klaravel/db-loggerin console to install this module
-
Open
config/app.phpand inproviderssection add:Klaravel\DbLogger\ServiceProvider::class,
-
Run:
php artisan vendor:publish --provider="Klaravel\DbLogger\ServiceProvider"
in your console to publish default configuration files
-
Open
config/dblogger.phpfile and adjust settings to your need (by default it uses.envfile so you can skip this step if you want). -
In your .env file add the following entries:
DB_LOG_QUERIES=true # if not needed make it false DB_LOG_SLOW_QUERIES=true # if not needed make it false DB_SLOW_QUERIES_MIN_EXEC_TIME=100 DB_LOG_OVERRIDE=false DB_LOG_DIRECTORY=logs/db DB_CONVERT_TIME_TO_SECONDS=false DB_LOG_SEPARATE_ARTISAN=falseand adjust values to your needs. If you have also
.env.sampleit's also recommended to add those entries also in.env.samplefile just to make sure everyone know about those env variables. Be aware thatDB_LOG_DIRECTORYis directory inside storage directory. If you want you can change it editingconfig/dblogger.phpfile.
Note:
Make sure defined
DB_LOG_DIRECTORYdirectory should be exists default direcotry is\storage\logs\db\else application will throw error.
统计信息
- 总下载量: 2.41k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-10-03