Access laravel logs through the Artisan Console.
This package is using devdot/monolog-parser to parse logfiles that were created by Laravel.
Add the package to your Laravel application:
composer require devdot/log-artisanTake a look at the last few log entries using the console:
php artisan log:showExample result:
Show the results in a compressed single line view using --singleline or -s:
Search through logs using log:search, with search terms that can be regex:
Clear all log files like this:
php artisan log:clearView details about the current logging configuration and status:
php artisan log:aboutShow entries from the logs (this will merge all logfiles and sort by date).
php artisan log:showUse these options to narrow the results:
| Option | Name | Description |
|---|---|---|
| -c, --count | Count | Show this amount of entries, default is 10 |
| -l, --level | Log Level | Show only entries with this log level |
| --channel | Log Channel | Use this specified logging channel |
| --short | Short view | Only show short snippets |
| -s, --singleline | Single-line view | Show single-lined layout |
| --stacktrace | Stacktrace view | Show the full stacktrace |
Example (show full logged stacktraces for the latest 100 log entries with level DEBUG):
php artisan log:show -c100 --level=DEBUG --stacktraceSearch 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 *.
php artisan log:search test
php artisan log:search "(test|regex \w+)"Options are the same as with log:show.
Clear a given logging channel. Use option --all to clear all configured channels.
php artisan log:clear single
php artisan log:clear --allThis command will write a new log entry to each cleared file.