Flare by Spatie
    • Error Tracking
    • Performance Monitoring
    • Logs Coming soon
  • Pricing
  • Docs
  • Insights
  • Changelog
  • Back to Flare ⌘↵ Shortcut: Command or Control Enter
  • Sign in
  • Try Flare for free
  • Error Tracking
  • Performance Monitoring
  • Logs Coming soon
  • Pricing
  • Docs
  • Insights
  • Changelog
    • Back to Flare ⌘↵ Shortcut: Command or Control Enter
    • Try Flare for free
    • Sign in
Flare Flare Laravel Laravel PHP PHP JavaScript JavaScript React React Vue Vue Protocol Protocol
  • General
  • Installation
  • Censoring collected data
  • Ignoring collected data
  • Flare daemon
  • Laravel Octane
  • Laravel Vapor
  • Errors
  • Adding custom context
  • Customise error report
  • Customising error grouping
  • Handling errors
  • Linking to errors
  • Reporting errors
  • Logs
  • Introduction
  • Levels
  • With errors
  • Performance
  • Introduction
  • Sampling
  • Limits
  • Modify spans and span events
  • Data Collection
  • Application info
  • Cache events
  • Console commands
  • Database transactions
  • Dumps
  • Errors when tracing
  • Exception context
  • External http requests
  • Filesystem operations
  • Git information
  • Glows
  • Identifying users
  • Jobs and queues
  • Laravel context
  • Livewire
  • Queries
  • Redis commands
  • Requests
  • Server info
  • Spans
  • Stacktrace arguments
  • Views
  • Older Packages
  • Laravel Flare V2
  • Laravel Flare V1
  • Ignition

Introduction

Flare can collect and display your application's log messages. This gives you insight into what your application is doing, beyond just error tracking.

Enabling log collection

Log collection is disabled by default. To enable it, set the log key to true in your config/flare.php file:

'log' => true,

You can also set a minimal log level so that only logs at or above that severity are sent:

'minimal_log_level' => \Monolog\Level::Warning,

Shipping logs under high load

By default, logs are shipped over HTTP at the end of each request together with the rest of the request's telemetry. That works well for most applications, but once log volume picks up the per request HTTP round trip can start to weigh on your workers.

If you're sending a lot of logs, run the Flare daemon alongside your application. The daemon takes the upstream delivery off the request path entirely so log volume doesn't slow your application down. See the Flare daemon page for setup details.

Setting up the logging channel

To feed logs from Laravel to Flare, add the following channel to your config/logging.php file:

'channels' => [

    // other channels...

    'flare' => [
        'driver' => 'flare',
    ],
],

Then add the Flare channel to the LOG_STACK variable in your .env file:

LOG_STACK=single,flare

Now any log call in your application will also be sent to Flare:

Log::info('User signed in', ['user_id' => 42]);
Log::warning('Slow query detected');

Laravel Vapor

When using Laravel Vapor, you should use a vapor channel that combines the Flare channel with stderr:

'channels' => [

    // other channels...

    'flare' => [
        'driver' => 'flare',
    ],

    'vapor' => [
        'driver' => 'stack',
        'channels' => ['flare', 'stderr'],
        'ignore_exceptions' => false,
    ],
],

Then set the log channel in your .env file:

LOG_CHANNEL=vapor

Manually recording logs

If you're writing log messages outside of Laravel's logging system, you can record them manually. The PHP documentation provides a full overview of all available recorder methods. When using these methods in Laravel, use the Flare facade instead of $flare:

use Spatie\LaravelFlare\Facades\Flare;
use Monolog\Level;

Flare::log()->record(
    message: 'This is a log message',
    level: Level::Info,
    context: ['team_id' => 1],
);

Disabling log collection

To disable log collection, set the log key to false in your config/flare.php file:

// config/flare.php
'log' => false,
Reporting errors Levels
  • On this page
  • Enabling log collection
  • Shipping logs under high load
  • Setting up the logging channel
  • Manually recording logs
  • Disabling log collection

Catch errors and fix slowdowns with Flare, the full-stack application monitoring platform for Laravel, PHP & JavaScript.

  • Platform
  • Error Tracking
  • Performance Monitoring
  • Pricing
  • Support
  • Resources
  • Insights
  • Newsletter
  • Changelog
  • Documentation
  • Affiliate program
  • uptime status badge Service status
  • Terms of use
  • DPA
  • Privacy & cookie Policy
Made in by
Flare