Skip to content

App crashes with Sentry console logging integration in SDK 9.37.0 #16920

Closed

Description

@AbhiPrasad

@coby.eastwood said:

Hey team, came across a problem when setting up logs for javascript, on our latest SDK version 9.37.0. My app will crash when enabling Sentry.consoleLoggingIntegration({levels: [‘log’]}), logging with Sentry.logger.warn('test'), and then using console log in beforeSendLog. Seems it is getting called recursively and crashes in chrome but in firefox it will show:

{
  "level": "info",
  "message": "beforeSendLog {\"level\":\"info\",\"message\":\"beforeSendLog {\\\"level\\\":\\\"info\\\",\\\"message\\\":\\\"beforeSendLog {\\\\\\\"level\\\\\\\":\\\\\\\"info\\\\\\\",\\\\\\\"message\\\\\\\":\\\\\\\"beforeSendLog {\\\\\\\\\\\\\\\"level\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"info\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\"message\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"beforeSendLog \ … continues… \"sentry.sdk.version\":\"9.37.0\"}}",
  "severityNumber": 10,
  "attributes": {
    "sentry.origin": "auto.console.logging",
    "sentry.sdk.name": "sentry.javascript.react",
    "sentry.sdk.version": "9.37.0"
  }
}

Made a repro here.

Activity

  1. self-assigned this
    on Jul 10, 2025
  2. mydea commented on Jul 11, 2025

    @mydea
    Member

    can we avoid this? 🤔 I guess we could call beforeSendLog in consoleSandbox...?

  3. AbhiPrasad commented on Jul 11, 2025

    @AbhiPrasad
    ContributorAuthor

    yup that's the fix, we need to use consoleSandbox like we do for beforeBreadcrumb

  4. github-actions commented on Jul 15, 2025

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #16968, which was included in the 9.39.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions