Use LogViewer in Laravel

Tram Ho

Laravel has an easy-to-use logging system that is saved as a txt log file. But that is also the drawback of text files. It is quite difficult for developers to read, search for errors, necessary information. LogViewer solves these problems, turning the text log file into a vivid, intuitive user interface

Log file before using LogViewer

After using LogViewer have interface

Install LogViewer

Run command

Configuration

For laravel> 5.5

  • Edit the environment file .env LOG_CHANNEL=daily
  • Publish logviewer configuration with command: php artisan log-viewer:publish

With laravel <= 5.5

  • Edit APP_LOG=daily in the .env file
  • Add code line ArcanedevLogViewerLogViewerServiceProvider::class, to array providers in config/app.php
  • And finally run the command to publish the logviwer configuration: php artisan log-viewer:publish

Run Logviewer

To view log laravel with Logviewer, you access via the link: http: // yourrooturl / log-viewer (ex: http://127.0.0.1:8000/log-viewer ). We will see the Logviewer interface below

Logviewer has many categories from high to low:

  • Emergency
  • Alert
  • Critical
  • Warning
  • Notice
  • Info
  • Debug

Try creating some examples for these types of logs

Then reload the index page to let the system log the information. Reload Logviewer we get the results

As you can see, Logviewer is very useful, not only for developers but also for testers to make it easier to ensure the quality of the project.

Share the news now

Source : Viblo