devdot / log-artisan
View and manage log files using the artisan CLI
Requires
- php: ^8.2
- devdot/monolog-parser: ^1.6
- illuminate/console: ^11
- illuminate/contracts: ^11
Requires (Dev)
- captainhook/captainhook: ^5.16
- orchestra/testbench: ^9.0
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^11.1
- squizlabs/php_codesniffer: ^3.9
README
Access laravel logs through the Artisan Console.
This package is using devdot/monolog-parser to parse logfiles that were created by Laravel.
Installation
Add the package to your Laravel application:
composer require devdot/log-artisan
Basic Usage
Take a look at the last few log entries using the console:
php artisan log:show
Example 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:clear
Documentation
About Command
View details about the current logging configuration and status:
php artisan log:about
Show Command
Show entries from the logs (this will merge all logfiles and sort by date).
php artisan log:show
Use these options to narrow the results:
Example (show full logged stacktraces for the latest 100 log entries with level DEBUG):
php artisan log:show -c100 --level=DEBUG --stacktrace
Search Command
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 *
.
php artisan log:search test php artisan log:search "(test|regex \w+)"
Options are the same as with log:show
.
Clear Command
Clear a given logging channel. Use option --all
to clear all configured channels.
php artisan log:clear single php artisan log:clear --all
This command will write a new log entry to each cleared file.