Laravel command logger package

Ivan Kolodii
1 min readJul 6, 2018

Let me introduce our new laravel package for logging console commands.

It was developed specially for our Tenantcloud project. It is rather simple but at the same time really useful.

In our development process we faced with the problem of many cron jobs and console commands. Some of them were executing for a long time and we could not debug it. So we created simple package for this purpose.

To install it simply type:

composer require tenantcloud/command-logger

And add CommandLoggerServiceProvider to your config/app.php file.

By default it saves log information into Database and Log files. So you need to run migration right after that.

You can change table name using config and disable or enable channel. Also you can write your own channels.

Log information includes:

  • command signature
  • execution time (most important information)
  • memory peak (return peak memory usage in Mb)
  • host (server name)

Example of DB log

Under the hood it uses Illuminate\Console\Events\CommandFinished event. It was added in Laravel 5.5 version via PR.

Do your lara well :) and contribute to open-source!

--

--