Persistent Logging For Laravel PHP Apps

Amezmo is a platform as a service dedicated to PHP app hosting. Start your free trial today and get your app deployed fast.

By default, Amezmo will create a dedicated directory for your application’s logging purposes. We recommend using this dedicated directory so you can persist your logs across deployments. The full path is /webroot/logs

For this tutorial, we’ll be using a Laravel based web application. To follow along, open up the app/config/logging.php file. For each log channel, change the default path from storage_path('logs/laravel.log'), to /webroot/logs/laravel.log Your configuration file should look like similar to this:


<?php

return [
    'default' => 'stack',
    'channels' => [

        'daily' => [
            'driver' => 'daily',
            'permission' => 0664,
            'path' => '/webroot/logs/laravel.log',
            'level' => 'debug',
            'days' => 14,
        ],
    ],

];

With the above configuration, your log files will persist across deployments and you don’t have to worry about creating a symbolic link.

Viewing your logs

From the Amezmo dashboard, you can view and download your log files in real time. By default, a truncated version is displayed, but you may download the full contents of the file.