Laravel Log Monitoring with LogMonitor
>_ why laravel apps need log monitoring
Laravel applications generate logs across HTTP requests, queued jobs, scheduled tasks, and artisan commands. The default log files grow large and are difficult to search, especially on multi-server deployments. LogMonitor gives you a centralized Live Console that streams logs from every Laravel process in real time with structured filtering.
>_ how logmonitor works with laravel
Create a custom Laravel log channel that sends logs to the LogMonitor HTTP API. Add the channel to your logging.php config and use it alongside or instead of the default stack. The API returns 202 Accepted on success. All Log::info(), Log::error(), and exception handler logs are automatically forwarded to your LogMonitor dashboard.
>_ quick start
<?phpnamespace App\Logging;use Monolog\Handler\AbstractProcessingHandler;use Monolog\LogRecord;use Illuminate\Support\Facades\Http;class LogMonitorHandler extends AbstractProcessingHandler{ protected function write(LogRecord $record): void { Http::withHeaders([ 'X-Logmonitor-Api-Key' => config('services.logmonitor.api_key'), 'Content-Type' => 'application/json', ]) ->post('https://api.logmonitor.io/v1/logs', [ [ 'level' => strtolower($record->level->name), 'message' => $record->message, 'clientTimestamp' => time(), ], ]); // Returns 202 Accepted on success }}// In config/logging.php channels array:// 'logmonitor' => ['driver' => 'monolog', 'handler' => App\Logging\LogMonitorHandler::class]// Usage: Log::channel('logmonitor')->error('Payment failed', ['order_id' => 456]);>_ what you can monitor
- $HTTP request errors and exception traces
- $Queued job failures and retries
- $Scheduled task (cron) execution logs
- $Database query errors and slow queries
- $Authentication and authorization failures
- $Third-party API integration errors
>_ frequently asked questions
Yes. Set LOG_CHANNEL=logmonitor in your .env file or add 'logmonitor' to your stack channel. All Log:: calls and exception reports will be forwarded to LogMonitor automatically.
Yes. Laravel's exception handler uses the configured log channel to report errors. If LogMonitor is your active channel, all unhandled exceptions are sent to your Live Console with full stack traces.
Yes. Queued job workers use the same logging configuration. Any Log:: calls inside your job classes and any job failure exceptions are sent to LogMonitor through the custom channel.
The HTTP call is fast, but for zero overhead you can dispatch the log sending to a queue or use Laravel's async HTTP client. This ensures the API call never blocks your request lifecycle.
Yes. LogMonitor is infrastructure-agnostic. Whether you deploy on Vapor (serverless), Forge, Envoyer, or a custom server, the custom log channel works the same way as long as the app can reach the LogMonitor API.