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
  • Introduction
  • Customise error report
  • Customising error grouping
  • Linking to errors
  • Logs
  • Introduction
  • Levels
  • With errors
  • Performance
  • Introduction
  • Sampling
  • Limits
  • Modify spans and span events
  • Data Collection
  • Application info
  • Cache events
  • Console commands
  • Custom context
  • 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

Console commands

Flare can collect information about the console commands that are being executed. Whether an error happens during a command or you want to trace a long-running command, Flare will collect the following information:

  • The command name
  • The command arguments
  • The exit code

This functionality is enabled by default, but you can disable it by ignoring the Commands collect in config.php:

use Spatie\FlareClient\Enums\CollectType;

'collects' => FlareConfig::defaultCollects(
    ignore: [CollectType::Commands],
),

Ignoring specific commands

You can drop traces for individual commands by name or class. Names are matched against the command identifier (e.g. horizon:work), classes are matched against the fully qualified command class.

use Spatie\FlareClient\Enums\CollectType;

'collects' => FlareConfig::defaultCollects(
    extra: [
        CollectType::Commands->value => [
            'ignored_commands' => ['horizon:*', 'schedule:run'],
            'ignored_classes' => [App\Console\Commands\InternalCleanup::class],
        ],
    ],
),

Patterns are literal strings with * as a wildcard. When the ignored command is the top-level command, the trace is unsampled. When it runs nested inside another sampled trace, the recorder skips the inner span and resumes recording afterwards.

Manually recording commands

If you're running commands or subprocesses that aren't automatically tracked by Laravel, 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;

Flare::command()->recordStartFromDefined(
    command: 'my:command',
    arguments: ['--option' => 'value'],
);

// ... run the command

Flare::command()->recordEnd(exitCode: 0);
Cache events Custom context
  • On this page
  • Ignoring specific commands
  • Manually recording commands

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