devdot / log-artisan
View and manage log files using the artisan CLI
Installs: 388
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/devdot/log-artisan
Requires
- php: ^8.2
 - devdot/monolog-parser: ^1.6
 - illuminate/console: ^11.0|^12.0
 - illuminate/contracts: ^11.0|^12.0
 
Requires (Dev)
- captainhook/captainhook: ^5.16
 - orchestra/testbench: ^9.0|^10.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:
| 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 --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.