These libraries help developers monitor application stability, track errors, and understand user sessions in production. sentry and bugsnag focus heavily on error aggregation and performance metrics. logrocket specializes in session replay to visualize user interactions. rollbar provides real-time error monitoring with strong deployment tracking. Together, they form the core toolkit for maintaining reliability in modern web apps.
When building production-grade web applications, knowing when things break is not enough β you need to know why, where, and how often. sentry, bugsnag, rollbar, and logrocket are the leading solutions for this problem, but they approach visibility from different angles. Let's compare how they handle initialization, error capture, session visibility, and performance.
Getting these tools running requires different configuration styles. Some use a global client, while others rely on framework-specific SDKs.
sentry uses a centralized init method that accepts a Data Source Name (DSN).
// sentry: Standard initialization
import * as Sentry from "@sentry/react";
Sentry.init({
dsn: "https://publicKey@o0.ingest.sentry.io/0",
integrations: [new Sentry.BrowserTracing()],
tracesSampleRate: 1.0,
});
bugsnag starts a client instance using an API key.
// bugsnag: Standard initialization
import bugsnag from "@bugsnag/js";
const bugsnagClient = bugsnag.start({
apiKey: "YOUR_API_KEY",
collectUserIp: false,
enabledReleaseStages: ["production"],
});
rollbar configures a global object with an access token.
// rollbar: Standard initialization
import Rollbar from "rollbar";
const rollbar = new Rollbar({
accessToken: "YOUR_ACCESS_TOKEN",
captureUncaught: true,
captureUnhandledRejections: true,
});
logrocket initializes with an app ID and focuses on recording sessions.
// logrocket: Standard initialization
import LogRocket from "logrocket";
LogRocket.init("YOUR_APP_ID", {
network: {
isEnabled: true,
},
});
All four tools catch unhandled exceptions automatically, but manual reporting gives you control over context.
sentry allows you to capture exceptions and add custom scope data.
// sentry: Manual capture
try {
riskyOperation();
} catch (err) {
Sentry.captureException(err, {
tags: { feature: "checkout" },
});
}
bugsnag uses a notify method to send errors with metadata.
// bugsnag: Manual capture
try {
riskyOperation();
} catch (err) {
bugsnagClient.notify(err, {
metadata: { feature: "checkout" },
});
}
rollbar provides specific methods for different error levels.
// rollbar: Manual capture
try {
riskyOperation();
} catch (err) {
rollbar.error(err, {
feature: "checkout",
});
}
logrocket tracks errors implicitly via session recording, but you can manually track events.
// logrocket: Manual tracking
try {
riskyOperation();
} catch (err) {
LogRocket.track("Checkout Error", {
message: err.message,
});
}
This is where the tools diverge significantly. Some show you a video-like replay, while others show aggregated session data.
sentry offers "Replay" as an integration to record DOM activity.
// sentry: Enable Replay
import * as Sentry from "@sentry/react";
Sentry.init({
dsn: "...",
integrations: [
new Sentry.Replay({
maskAllText: true,
blockAllMedia: true,
}),
],
replaysSessionSampleRate: 0.1,
});
bugsnag focuses on "Session Tracking" for stability scores, not DOM replay.
// bugsnag: Start Session
import bugsnag from "@bugsnag/js";
const client = bugsnag.start({ apiKey: "..." });
client.startSession();
// Tracks crash-free % rather than visual replay
rollbar provides context around errors but does not offer full session replay.
// rollbar: Person Tracking
import Rollbar from "rollbar";
Rollbar.configure({
payload: {
person: {
id: "123",
username: "john_doe",
},
},
});
// Links errors to users without visual replay
logrocket is built entirely around session replay and console recording.
// logrocket: Identify User
import LogRocket from "logrocket";
LogRocket.identify("123", {
name: "John Doe",
email: "john@example.com",
});
// Records full DOM, network, and console logs for playback
Understanding speed is just as important as stability. Some tools measure Web Vitals automatically.
sentry has built-in performance monitoring and Web Vitals support.
// sentry: Transaction start
import { startTransaction } from "@sentry/react";
const transaction = startTransaction({ name: "custom-transaction" });
// Automatically tracks spans and Web Vitals
bugsnag tracks performance via "Timeline" breadcrumbs rather than full APM.
// bugsnag: Leave Breadcrumb
import bugsnag from "@bugsnag/js";
bugsnag.leaveBreadcrumb("Performance check", {
duration: 120,
});
// Manual timing rather than auto APM
rollbar allows you to send performance data as part of the payload.
// rollbar: Custom Data
import Rollbar from "rollbar";
Rollbar.log("Performance metric", {
loadTime: window.performance.timing.loadEventEnd,
});
// Custom implementation required for metrics
logrocket records network request timing automatically within sessions.
// logrocket: Network Monitoring
import LogRocket from "logrocket";
// Enabled via init config
LogRocket.init("APP_ID", {
network: {
isEnabled: true,
requestSanitizer: (req) => req,
},
});
// Visualizes slow requests in the replay timeline
Despite their differences, these libraries share core goals and patterns.
window.onerror and unhandledrejection.// All packages: Auto-capture
// No code needed β they wrap global listeners internally
// sentry: beforeSend
Sentry.init({
beforeSend(event) {
// Remove sensitive data
return event;
},
});
// logrocket: Privacy
LogRocket.init("ID", { privacy: { blockSelector: ".secret" } });
// bugsnag: Set User
bugsnagClient.setUser("id", "name", "email");
// rollbar: Configure Person
Rollbar.configure({ payload: { person: { id: "123" } } });
// sentry: React Router
import { createRoutesFromChildren, matchRoutes } from "react-router-dom";
// Sentry handles this via BrowserTracing integration
// logrocket: Redux
import { createLogger } from "redux-logger";
// LogRocket has specific middleware for Redux
| Feature | sentry | bugsnag | rollbar | logrocket |
|---|---|---|---|---|
| Core Focus | π All-in-one Observability | π‘οΈ Stability & Crash Rates | π Error & Deployment Tracking | πΌ Session Replay & UX |
| Session Replay | β Yes (Integration) | β No (Session Tracking only) | β No | β Yes (Core Feature) |
| Performance APM | β Full Tracing | β οΈ Limited (Breadcrumbs) | β οΈ Manual | β Network Timing |
| Setup Complexity | βοΈ Moderate | β Simple | β Simple | β Simple |
| Privacy Controls | π Advanced Masking | π Advanced Masking | π Standard | π Advanced Masking |
sentry is the heavy-duty option ποΈ β best for teams that want errors, performance, and replays in one place. It scales well but requires more configuration.
bugsnag is the stability specialist π β perfect for teams focused on reducing crash rates and prioritizing fixes based on impact.
rollbar is the deployment companion π’ β ideal for teams that need to know immediately if a release broke something.
logrocket is the UX microscope π β unmatched for debugging interaction issues where you need to see the user's screen.
Final Thought: Many teams use a combination. A common pattern is sentry for errors and performance, paired with logrocket for deep dive session debugging. Choose based on whether you need to know that it broke, or how it broke.
Choose sentry if you want an all-in-one platform covering errors, performance, and replays. It has the largest ecosystem and supports almost every framework out of the box. This is the right choice for teams that prefer a single vendor for all observability needs rather than stitching multiple tools together.
Choose bugsnag if your primary goal is maximizing application stability and crash-free session rates. It excels at grouping similar errors and providing clear severity levels. This is ideal for teams that need to prioritize fixing the most impactful crashes quickly without getting lost in noise.
Choose logrocket if you need to see exactly what users did before an error occurred. Its session replay feature records DOM changes, console logs, and network requests. This is the best fit for debugging complex interaction bugs or UX issues where stack traces alone are not enough.
Choose rollbar if you want a straightforward error tracker with strong deployment correlation. It helps you know immediately if a new release caused a spike in errors. This suits teams that deploy frequently and need tight integration between their CI/CD pipeline and error monitoring.
The command-line interface for Sentry. Built for developers and AI agents.
Documentation | Getting Started | Commands
curl https://cli.sentry.dev/install -fsS | bash
brew install getsentry/tools/sentry
npm install -g sentry
pnpm add -g sentry
yarn global add sentry
bun add -g sentry
The npm/pnpm/yarn packages require Node.js 20+. On Node.js 22.15+ the CLI uses the built-in
node:sqlite; on Node.js 20β22.14 it transparently falls back to a bundled WASM SQLite driver.
npx sentry@latest
pnpm dlx sentry --help
yarn dlx sentry --help
bunx sentry --help
# Authenticate with Sentry
sentry auth
# List issues (auto-detects project from your codebase)
sentry issue list
# Get AI-powered root cause analysis
sentry issue explain PROJ-ABC
# Generate a fix plan
sentry issue plan PROJ-ABC
.env files or source code. No flags needed.--json for scripting and pipelines.-w flag to open any resource in your browser.Run sentry --help to see all available commands, or browse the command reference.
Credentials are stored in $XDG_CONFIG_HOME/sentry/ (defaulting to ~/.config/sentry/) with restricted permissions (mode 600). A pre-existing legacy ~/.sentry/ directory is still honored, and the location can be overridden with SENTRY_CONFIG_DIR.
Use Sentry CLI programmatically in Node.js (β₯20.0) without spawning a subprocess:
import createSentrySDK from "sentry";
const sdk = createSentrySDK({ token: "sntrys_..." });
// Typed methods for every CLI command
const orgs = await sdk.org.list();
const issues = await sdk.issue.list({ orgProject: "acme/frontend", limit: 5 });
const issue = await sdk.issue.view({ issue: "ACME-123" });
// Nested commands
await sdk.dashboard.widget.add({ display: "line", query: "count" }, "my-org/my-dashboard");
// Escape hatch for any CLI command
const version = await sdk.run("--version");
const text = await sdk.run("issue", "list", "-l", "5");
Options (all optional):
token β Auth token. Falls back to SENTRY_AUTH_TOKEN / SENTRY_TOKEN env vars.url β Sentry instance URL for self-hosted (e.g., "sentry.example.com").org β Default organization slug (avoids passing it on every call).project β Default project slug.text β Return human-readable string instead of parsed JSON (affects run() only).cwd β Working directory for DSN auto-detection. Defaults to process.cwd().headers β Extra HTTP headers for self-hosted instances behind a reverse proxy (same as SENTRY_CUSTOM_HEADERS). Ignored for sentry.io.signal β AbortSignal to cancel streaming commands (--follow, --refresh).Streaming commands return AsyncIterable β use for await...of and break to stop.
Errors are thrown as SentryError with .exitCode and .stderr.
git clone https://github.com/getsentry/toolkit.git
cd toolkit
pnpm install
cd packages/cli
# Run CLI in development mode
pnpm run cli -- --help
# With environment variables (create .env.local first, see DEVELOPMENT.md)
pnpm run cli -- --help
pnpm run build # Build for current platform
pnpm run typecheck # Type checking
pnpm run lint # Check for issues
pnpm run lint:fix # Auto-fix issues
pnpm run test:unit # Run unit tests
pnpm run test:e2e # Run end-to-end tests
pnpm run generate:docs # Regenerate command docs and skills
See DEVELOPMENT.md for detailed setup and CONTRIBUTING.md for contribution guidelines.