New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

avengers-code-lovers/laravel-log-monitoring

Laravel log monitoring with log Laravel and log queue from avengers code lovers
6,453 9
Install
composer require avengers-code-lovers/laravel-log-monitoring
Latest Version:1.3.0
PHP:>=7.1
Laravel:5 – 8
Last Updated:Jul 1, 2021
Links: GitHub  ·  Packagist
Maintainer: kenini1805

Documentation

To get started with Monitoring Log Laravel, use Composer to add the package to your project's dependencies:

   composer require avengers-code-lovers/laravel-log-monitoring

Configuration

Laravel 5.5+

Laravel uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

Laravel < 5.5:

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php

'providers' => [
    // Other service providers...

    AvengersGroup\MonitoringServiceProvider::class

],

Set your session start to global middleware in app/Http/Kernel.php

protected $middleware => [
    // Other global middleware...

    \Illuminate\Session\Middleware\StartSession::class,
];

protected $middlewareGroups => [
    'web' => [
        \App\Http\Middleware\EncryptCookies::class,
        \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
        //\Illuminate\Session\Middleware\StartSession::class,       // Comment this
        // ...
    ],
];

You will also need to add api_key chatwork bot and room sos for services your application utilizes. These credentials should be placed in your config/services.php configuration file, and use the key chatwork. For example:

    'chatwork' => [
        'api_key' => env('CHATWORK_API_KEY'),
        'room_id_sos' => env('CHATWORK_API_ROOM_ID'),
        'role' => [
            'admin' => 'admin'
        ]
    ]

Add key in .env

CHATWORK_API_KEY=xxxxx
CHATWORK_API_ROOM_ID=xxxxx

Basic Usage Monitoring Log Laravel Application Error

Add Monitoring Log Laravel reporting to App/Exceptions/Handler.php:

public function report(Exception $exception)
{
    app('monitoring')->sendExceptionToChatWork($exception);

    parent::report($exception);
}

Basic Usage Monitoring Log Queue Error

Follow document in https://laravel.com/docs/master/queues#cleaning-up-after-failed-jobs

/**
 * The job failed to process.
 *
 * @param  Exception  $exception
 * @return void
 */
public function failed(Exception $exception)
{
    app('monitoring')->sendExceptionToChatWork($exception);
}

Advance Usage

Monitoring Log Laravel support reporting accept $request as param with supportable functions which come with a message with more infomation

Add Monitoring Log Laravel reporting to App/Exceptions/Handler.php:

/**
 * Render an exception into an HTTP response.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Exception  $exception
 * @return \Illuminate\Http\Response
 */
public function render($request, Exception $exception)
{
    app('monitoring')->sendExceptionToChatWork($exception, $request);

    return parent::render($request, $exception);
}

Related Packages

storviaio/vantage

Vantage: Strategic queue monitoring and observability for Laravel applications.

164,158 263
ashiqfardus/horizon-running-jobs

Monitor currently running jobs in Laravel Horizon for distributed systems

1,570 6
laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

116,825,357 4,178
queueworker/sansdaemon

Batch process Laravel Queue without a daemon; Processes queue jobs and kills the...

204,666 178
cboxdk/laravel-queue-metrics

Production-ready Laravel queue monitoring with metrics, analytics, and insights

14,141 12

Version History

Version Released PHP Laravel License
1.3.0 >=7.1 ~5.7.0|~5.8.0|^6.0|^7.0|^8.0
1.2.0 >=7.1 ~5.7.0|~5.8.0|^6.0|^7.0|^8.0
1.1.0 >=7.1 ~5.7.0|~5.8.0|^6.0|^7.0|^8.0
1.0.0 >=7.1 ~5.7.0|~5.8.0|^6.0|^7.0