Laravel & LogViewer login instructions for developers

Laravel & LogViewer login instructions for developers

Laravel ships with a logging system that is easily utilized, these logs end up .txt log files within your project. Whilst in the text files, they are pretty useless and boring, but if you add a lovely little plugin named LogViewer, things become pretty awesome.

LogViewworks with Laravel 5.0 all the way through to 5.8 so, most likely, you will be able to use it immediately.

So, let’s see what log viewer gives us.

The following text is generally what you will see in your log files –

You may also like:Tutorial Laravel 6 with Docker and Docker-Compose

From this, with LogViewer, it is transformed into the following

Log Viewer Dashboard

Log Viewer Overview

Log Viewer Log Details

Which, frankly is pretty amazing, considering that all this data is stored in a boring plain text file. So, how can I start using Log Viewer you ask? Simply follow the rest of this tutorial, which will explain how to install the Log Viewer and in addition, go into how you can utilize your own custom logs throughout your code.

Installing LogViewer

Step 1

If you’ve got Laravel 5.8, then run the following command, this will install the LogViewer package and publish it automatically. Otherwise, check out the version compatibility table to find the matching version located on this page here.

composer require arcanedev/log-viewer:~4.7.0

Step 2

If your Laravel version > 5.5

  1. Open your .env file and change the LOG_CHANNEL value to daily rather than stack.
  2. Just to make sure it automatically published run the following command – php artisan log-viewer:publish

If your Laravel version <= 5.5

  1. Open your .env file and change the LOG_CHANNEL value to daily rather than stack.
  2. Just to make sure it automatically published run the following command – php artisan log-viewer:publish

Step 3

Navigate to your http://yourrooturl/log-viewer, In my case, for this tutorial it’s http://localhost/LaravelLogger/log-viewer.

You should now see the LogViewer dashboard.

Using Custom Logs

If you’ve only recently installed Laravel, you will notice that you don’t have many logs at all in the dashboard. As you can see from my screenshot earlier, I had a few error logs. (See below)

Log Viewer Dashboard

But notice all of those other potential logs,

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

You can easily utilize these logs in your code, there’s actually a lot of documentation on how to use the logging system on the Laravel website.

But, I will quickly show you how easy it is to start using the logs immediately.

Step 1

To use the logging system, you will need to reference it, add the following at the top of your controller or file of choice –

use Illuminate\Support\Facades\Log;

Step 2

Make some logs! For this example, I will simply add the following commands inside one of my controller functions. Specifically, my home controller index function. You can repeat this into the file of choice where you’ve referenced the Log library.

public function index() {

&nbsp; &nbsp; &nbsp; &nbsp; // Lets add some logs.
&nbsp; &nbsp; &nbsp; &nbsp; Log::alert("This is a new Alert!");
&nbsp; &nbsp; &nbsp; &nbsp; Log::critical("This is a critical error message");
&nbsp; &nbsp; &nbsp; &nbsp; Log::debug("This is a debug message");
&nbsp; &nbsp; &nbsp; &nbsp; Log::emergency("There is an emergency! Help!?!?!?!");
&nbsp; &nbsp; &nbsp; &nbsp; Log::error("Houston, we have an error");
&nbsp; &nbsp; &nbsp; &nbsp; Log::info("An informative message");
&nbsp; &nbsp; &nbsp; &nbsp; Log::notice("Notice!");
&nbsp; &nbsp; &nbsp; &nbsp; Log::warning("Be warned, be very warned");
&nbsp; &nbsp; &nbsp; &nbsp; return view('home.index');
&nbsp; &nbsp; }

Step 3

Then, load up the page where the logs will be executed and navigate back to the log viewer. See the result below –

Now the dashboard is full of logs! Albeit beautifully colorful, we wouldn’t really want to see this all in production!


If you go into the logs page, you can see each of the logs have incremented by one.

Finally, we can click into these, for the screenshot below, I clicked into the emergency log to see the detail

Of course, I’m just playing around here, but you get the gist of how useful these logs can actually be.

Another Example

Add the logs to some try-catch blocks in your code and execute it, this will deliver the exception message to your log viewer

try {
&nbsp; &nbsp; // some code to throw an exception
&nbsp; &nbsp; $divisionByZero = 5 / 0; // Divide 5 by zero
} catch (\Exception $e) {
&nbsp; &nbsp; Log::emergency("Exception Message: ".$e->getMessage()&nbsp; . " File: " . $e->getFile() . " Line: " . $e->getLine());

After executing the above code and going into the log viewer, something like the following will be shown –


LogViewer and Laravel logs have endless possibilities, whether it be an informative log that tells you people are logging off the website, registering, etc. Or of course, the many bugs we catch throughout our development lives. I hope you get as excited to use this as I first did!

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

To finish off, I thought id do a little video to show you the log viewer in its full glory.

Further Reading

How to Laravel 6 Database Migrations - Add Admin Role to Users

Laravel 5.8 Tutorial for Beginners

How to build a Laravel REST API with Test-Driven Development

Tutorial Laravel 6 with Docker and Docker-Compose

Originally published by  Dan Englishby*  at *


Thanks for reading :heart: If you liked this post, share it with all of your programming buddies! Follow me on Facebook | Twitter

web-development laravel php

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

PHP Web Application Development Company

As a top **PHP Web Application Development Company in USA**[]( ""), we at Data EximIT have...

PHP Website Development

Skenix Infotech is a leading PHP Web Development Company that helps companies get results with industry best practices. Get affordable PHP Development Services.

Laravel Development Company

Skenix Infotech is a top Laravel Website Development Company with Expert Laravel Developers that provides robust Laravel Development Services at fair costs.

Hire Dedicated PHP Developer

Looking to hire affordable yet experienced PHP developers? **[Hire Dedicated PHP Developer]( "Hire Dedicated PHP Developer")**, who can convert your idea to reality, within the stipulated...

Hire PHP Developer

Looking to develop a PHP based website from scratch or revamp your existing website? **[]( "")** has always been an industry leader for companies and business owners looking to hire...