You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This new handler allows you to capture Monolog logs as Sentry logs. To use it, configure your Monolog logger:
useMonolog\Logger;
useSentry\Monolog\LogsHandler;
useSentry\Logs\LogLevel;
// Initialize Sentry SDK first (make sure 'enable_logs' is set to true)\Sentry\init([
'dsn' => '__YOUR_DSN__',
'enable_logs' => true,
]);
// Create a Monolog logger$logger = newLogger('my-app');
// Add the Sentry logs handler// Optional: specify minimum log level (defaults to LogLevel::debug())$handler = newLogsHandler(LogLevel::info());
$logger->pushHandler($handler);
// Now your logs will be sent to Sentry$logger->info('User logged in', ['user_id' => 123]);
$logger->error('Payment failed', ['order_id' => 456]);
Note: The handler will not collect logs for exceptions (they should be handled separately via captureException).
Bug Fixes
Fix non string indexed attributes passed as log attributes (#1882)
Use correct sample_rate key when deriving sampleRand (#1874)
Do not call Reflection*::setAccessible() in PHP >= 8.1 (#1872)