Issue
After enabling the Sentry Angular SDK (@sentry/angular), errors no longer appear in the browser console. I expected Angular’s ErrorHandler console output (console.error) to keep working alongside Sentry.
Applies To
All SaaS Customers and Self-Hosted Users
Angular SDK (
@sentry/angular)Error Monitoring
Resolution
By default, Sentry’s Angular ErrorHandler still logs errors to the browser console. The logErrors option defaults to true.
Sentry replaces Angular’s default ErrorHandler with Sentry.createErrorHandler() so Sentry can capture errors. That handler calls console.error when logErrors is true.
If browser console error logging stopped after you added Sentry:
Search your app for
createErrorHandler,SentryErrorHandler, orlogErrors.If you pass
logErrors: false, setlogErrorstotrue(or remove the option so the default applies).Register the handler in
app.config.tsorapp.module.tslike this:import { ErrorHandler } from "@angular/core"; import * as Sentry from "@sentry/angular";{ provide: ErrorHandler, useValue: Sentry.createErrorHandler({ logErrors: true, }), }If you use a custom
ErrorHandlerthat extendsSentry.SentryErrorHandler, pass{ logErrors: true }tosuper(...), and callsuper.handleError(error)so Sentry still captures the error.If you replaced Angular’s
ErrorHandlerwith a fully custom handler that does not callconsole.errorand does not use Sentry’s handler, add console logging back, or switch toSentry.createErrorHandler({ logErrors: true }).
For all ErrorHandler options, see the Angular Error Handler documentation.
