|
| 1 | +Log Artisan |
| 2 | +=========== |
| 3 | + |
| 4 | +Access laravel logs through the Artisan Console. |
| 5 | + |
| 6 | +This package is using [devdot/monolog-parser](https://github.com/devdot/monolog-parser) to parse logfiles that were created by Laravel. |
| 7 | + |
| 8 | +## Installation |
| 9 | + |
| 10 | +Add the package to your Laravel application: |
| 11 | + |
| 12 | +```bash |
| 13 | +composer require devdot/log-artisan |
| 14 | +``` |
| 15 | + |
| 16 | +## Basic Usage |
| 17 | + |
| 18 | +Take a look at the last few log entries using the console: |
| 19 | + |
| 20 | +```bash |
| 21 | +php artisan log:show |
| 22 | +``` |
| 23 | + |
| 24 | +Example result: |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +Show the results in a compressed single line view using `--singleline` or `-s`: |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | +Search through logs using `log:search`, with search terms that can be regex: |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +## Documentation |
| 37 | + |
| 38 | +### About Command |
| 39 | + |
| 40 | +View details about the current logging configuration and status: |
| 41 | + |
| 42 | +```bash |
| 43 | +php artisan log:about |
| 44 | +``` |
| 45 | + |
| 46 | +### Show Command |
| 47 | + |
| 48 | +Show entries from the logs (this will merge all logfiles and sort by date). |
| 49 | + |
| 50 | +```bash |
| 51 | +php artisan log:show |
| 52 | +``` |
| 53 | + |
| 54 | +Use these options to narrow the results: |
| 55 | + |
| 56 | +| Option | Name | Description | |
| 57 | +|--------|------|-------------| |
| 58 | +|-c, --count | Count | Show this amount of entries, default is 10 | |
| 59 | +|-l, --level | Log Level | Show only entries with this log level | |
| 60 | +|--channel | Log Channel | Use this specified logging channel | |
| 61 | +|--short | Short view | Only show short snippets | |
| 62 | +|-s, --singleline | Single-line view | Show single-lined layout | |
| 63 | +|--stacktrace | Stacktrace view | Show the full stacktrace | |
| 64 | + |
| 65 | +Example (show full logged stacktraces for the latest 100 log entries with level DEBUG): |
| 66 | + |
| 67 | +```bash |
| 68 | +php artisan log:show -c100 --level=DEBUG --stacktrace |
| 69 | +``` |
| 70 | + |
| 71 | +### Search Command |
| 72 | + |
| 73 | +Search through the results with a given search term. The search term is treated as PHP regular expression, so make sure to escape any special characters like `.` or `*`. |
| 74 | + |
| 75 | +```bash |
| 76 | +php artisan log:search test |
| 77 | +php artisan log:search "(test|regex \w+)" |
| 78 | +``` |
| 79 | + |
| 80 | +Options are the same as with `log:show`. |
0 commit comments