-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Document interaction between captureConsoleIntegration and consoleLoggingIntegration #17118
Description
SDK
JavaScript SDK
Description
When using captureConsoleIntegration and consoleLoggingIntegration together, there is no documentation explaining that they are independent subscribers to the same console hook and will both fire for every matching console.* call. This leads to unexpected behavior where all console messages appear as Issues in the Sentry feed, even when the user's intent is to route them to the Logs product.
The same gap exists on the PHP/Laravel side for the sentry and sentry_logs logging channels.
Problem statement from affected customer here.
Suggested Solution
On the JavaScript Logs page (where consoleLoggingIntegration is introduced), add a note like:
Using
captureConsoleIntegrationalongsideconsoleLoggingIntegration?
Both integrations independently interceptconsole.*calls.captureConsoleIntegrationsends them as Issues (events), whileconsoleLoggingIntegrationsends them as Logs. Both default to all console levels.If you use both, configure non-overlapping
levelsto avoid console messages appearing as Issues:Sentry.init({ enableLogs: true, integrations: [ Sentry.captureConsoleIntegration({ levels: ['error'] }), Sentry.consoleLoggingIntegration({ levels: ['log', 'debug', 'info', 'warn'] }), ], });
On the captureConsoleIntegration page, add a cross-reference:
If you want console messages to appear in Sentry Logs instead of as Issues, see
consoleLoggingIntegration. If you use both integrations, configure their levels to avoid overlap.
On the Laravel Logs page, add a similar note explaining how sentry (Issues) and sentry_logs (Logs) channels relate and how to configure them together in config/logging.php.