Laravel 5.6 - Log viewer using LogViewer package example
Laravel provides log file that store all runtime error exception or any other error that get, we can view log file better using LogViewer composer package. laravel store very logs on a log file. So if it occurs any error, warning, alert etc that store in laravel log file. but it is store in error format, we can make it readable format and know how much error with a description, so we can resolve it and make it a better web application.
Here we will use LogViewer composer package for reading better way of an everyday log file. if you make setup on life for this format then we can simply monitor our application with a check if an error has come or not that way we can resolve small bug of code and make it smooth and better web application.
So, here we have to just install LogViewer package and all configuration so we can customize LogViewer package. So let's start to install and configuration of LogViewer package.
Installation Of LogViewer Package:
Now we will install LogViewer composer package using by following command in our laravel 5.6 application. So let's run bellow command.
composer require arcanedev/log-viewer
Ok, after install package successfully, we will add service provider in app.php configuration file. So let's add as bellow:
config/app.php
<?php
return [
....
'providers' => [
....
Arcanedev\LogViewer\LogViewerServiceProvider::class,
]
.....
]
Configuration Of LogViewer Package:
now we will generate configuration of LogViewer composer package like generate layout file, css file, config file etc. So let's run bellow command and get configuration of this package.
Publish the Config and Translations Files
php artisan log-viewer:publish
To force publishing
php artisan log-viewer:publish --force
Publishing the config only
php artisan log-viewer:publish --tag=config
Publishing the translations only
php artisan log-viewer:publish --tag=lang
Application requirements & log files check
php artisan log-viewer:check
Configuration Of Laravel Log:
now by default we have "stack" value in LOG_CHANNEL variable on env file for log. we have to change value stack into daily, so our package will display every day log. So let's change:
.env
LOG_CHANNEL=daily
Now we are ready to to run this package. so let's run our example so run bellow command for quick run:
php artisan serve
Open following URL:
http://localhost:8000/log-viewer
You will get layout like as bellow:
I hope it can help you....
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- Laravel 5.6 CRUD Application for Starter
- Laravel 5 - Simple CRUD Application Using ReactJS - Part 1
- Laravel Simple CMS Website using Asgardcms Example
- Laravel Custom User Log Activity Example Tutorial
- Laravel Dynamic Autocomplete Search using Select2 JS Ajax - Part 1
- Laravel Twitter API using Thujohn/twitter Tutorial
- Laravel - Multiple Images Uploading using dropzone.js Example