Flare by Spatie
  • Features
  • Pricing
  • Docs
  • Blog
  • LOG IN
  • START TRACKING
  • Home
  • Features
  • Pricing
  • Docs
  • Blog
    • Try Flare for free
    • Sign in
Flare Flare Laravel Laravel PHP PHP JavaScript JavaScript
  • General
  • Introduction
  • Installation
  • Censoring collected data
  • Ignoring collected data
  • Errors
  • Adding custom context
  • Customising error grouping
  • Handling errors
  • Linking to errors
  • Reporting errors
  • Performance
  • Introduction
  • Sampling
  • Limits
  • Modify spans and events
  • Data Collection
  • Application info
  • Application lifecycle
  • Cache events
  • Console commands
  • Customise error report
  • Database transactions
  • Dumps
  • Errors when tracing
  • Exception context
  • External http requests
  • Filesystem operations
  • Git information
  • Glows
  • Identifying users
  • Logs
  • Queries
  • Redis commands
  • Requests
  • Routing
  • Server info
  • Solutions
  • Spans
  • Stacktrace arguments
  • Views
  • Older Packages
  • Flare Client PHP V1

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

It is possible to disable this behaviour by ignoring commands in the Flare config:

$config->ignoreCommands();

You can configure the maximum number of commands tracked while collecting data in the case of an error as such:

$config->collectCommands(maxItemsWithErrors: 3);

Collecting commands

When you've enabled collecting command information and an error happens, the Flare client will automatically collect the command name and arguments.

During traces where multiple commands may be executed, you can manually add commands as such:

$flare->command()->recordStart('my:command', ['--option' => 'value']);

If you want to keep track of the class of the command that was executed:

$flare->command()->recordStart('my:command', ['--option' => 'value'], entryPointClass: MyCommand::class);

It is also possible to add extra attributes to the command:

$flare->command()->recordStart('my:command', ['--option' => 'value'], attributes: [
    'process.pid' => 80
]);

When the command ends (or fails), you can call the recordEnd method:

$flare->command()->recordEnd();

It is possible to provide the command exit code as such:

$flare->command()->recordEnd(exitCode: 0);

Extra attributes can be added when the command ends as well:

$flare->command()->recordEnd(attributes: [
    'process.pid' => 80
]);
Cache events Customise error report
  • On this page
  • Collecting commands

Monitor your web apps and sites from errors to slowdowns with Flare, the easiest application monitoring platform for Laravel, PHP & Javascript.

  • Platform
  • Error Tracking
  • Performance Monitoring
  • Pricing
  • Support
  • Resources
  • Blog
  • Changelog
  • Documentation
  • Affiliate program
  • Service status
  • Terms of use
  • DPA
  • Privacy & Cookie Policy
Flare