You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-3Lines changed: 29 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,9 @@
7
7
This module allows you to log SQL queries to log file in Laravel framework. It's useful mainly
8
8
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.
9
9
10
-
It reports a lot of metadata like total query count, total execution time, origin (request URL/console command), authenticated user, app environment, client browser agent / IP / hostname. You're also able to limit queries by a regex pattern, so you could e.g. only log
10
+
You may also use this in production as it should not cause a lot of overhead. Logged queries can be limited by query pattern, and logging only occurs at the end of each request or artisan command execution.
11
+
12
+
It reports a lot of metadata like total query count, total execution time, origin (request URL/console command), authenticated user, app environment, client browser agent / IP / hostname.
11
13
12
14
## Installation
13
15
@@ -25,7 +27,7 @@ It reports a lot of metadata like total query count, total execution time, origi
By default you should not edit published file because all the settings are loaded from `.env` file by default.
30
+
By default, you should not edit published file because all the settings are loaded from `.env` file by default.
29
31
30
32
3. In your `.env` file add the following entries:
31
33
@@ -55,7 +57,7 @@ It reports a lot of metadata like total query count, total execution time, origi
55
57
56
58
To find out more about those setting please take a look at [Configuration file](config/sql-reporter.php)
57
59
58
-
4. Make sure directory specified in `.env` file exists in storage path and you have valid file permissions to create and modify files in this directory (If it does not exist this package will automatically create it when needed but it's recommended to create it manually with valid file permissions)
60
+
4. Make sure directory specified in `.env` file exists in storage path, and you have valid permissions to create and modify files in this directory (If it does not exist this package will automatically create it when needed, but it's recommended to create it manually with valid file permissions)
59
61
60
62
5. Make sure on live server you will set logging SQL queries to falsein your `.env` file: `SQL_REPORTER_QUERIES_ENABLED=false`. This package is recommended to be used only for development to not impact production application performance.
### How does this package differ from `mnabialek/laravel-sql-logger` ?
@@ -124,9 +143,16 @@ Please star his great package on GitHub! You may use `composer thanks` for this.
124
143
125
144
All changes are listed in [CHANGELOG](CHANGELOG.md)
126
145
146
+
## Caveats
147
+
148
+
- If your application crashes, this package will not log any queries, as logging is only triggered at the end. As alternative, you could use [mnabialek/laravel-sql-logger](https://github.com/mnabialek/laravel-sql-logger) which triggers sql logging on each query execution.
149
+
- It's currently not possible to log slow queries into a separate logfile. I wanted to keep that package simpel.
150
+
127
151
## Todo
128
152
153
+
- [ ] Improve unit testing to reach 100% coverage
129
154
- [ ] Add browser type information to log headers, using hisorange/browser-detect
0 commit comments