Error tracking vs. logging: what each is for, how error grouping works and how to connect both with traces
Definitions, a side-by-side comparison, fingerprinting and stack traces, source maps, release correlation and regressions, noise control, trace_id correlation, a triage workflow and OpenTelemetry examples.
Summary
- Logging records what happened, event by event; error tracking turns exceptions into grouped issues with a stack trace, a first-seen release, a count of affected users and a status that someone owns.
- Good error tracking depends on fingerprinting that survives changing IDs and line numbers, source maps for minified JavaScript, and release and environment attributes on every event, so regressions show up right after a deployment.
- The two work best together: record exceptions on the active span with OpenTelemetry, log errors as structured events with the same trace_id, and move from an issue to the trace and the surrounding logs in one step.
Error tracking and logging both deal with things going wrong in production, which is why teams often ask whether they need both. Logging captures a stream of individual events, written by your code, that you search and aggregate later. Error tracking captures exceptions and failures, groups identical ones into a single issue, and attaches the context needed to fix them: the stack trace, the release that introduced the error, how many users are affected and who is responsible. The short answer to "error tracking vs. logging" is that they solve different parts of the same problem, and they become much more useful when they are connected through traces.
This article explains both disciplines, compares them side by side, and then goes into the details that decide whether application error monitoring actually helps: grouping and fingerprinting, stack traces, source maps for frontend JavaScript, release correlation and regressions, user impact, noise control, and correlation with traces and logs via trace_id. It ends with a triage workflow, guidance on logging errors well, OpenTelemetry examples and a checklist.
What is logging?
A log is a timestamped record of an event emitted by an application or system: a request was handled, a job started, a payment provider returned an error, a cache was refreshed. Each line has a log level such as DEBUG, INFO, WARN or ERROR, a message and, in a structured log, a set of fields. Logs are written for many purposes at once: debugging, auditing, security, business events and operations.
Logging is strong at telling the story of what happened around a problem. It is weak at answering "which errors are new, how often do they occur, and who is affected?" without significant query work, because every occurrence is a separate line and the same error can appear in many slightly different forms.
What is error tracking?
Error tracking is the practice of capturing unhandled and handled exceptions, failed requests and crashes as structured error events, and grouping them into issues. An issue represents one underlying bug, no matter whether it occurred once or a hundred thousand times. For each issue, an error tracking system typically shows:
- the exception type and message, with a symbolicated stack trace
- first seen and last seen, ideally with the release in which it first appeared
- occurrence count over time and the number of affected users or sessions
- environment, service, host, browser or device, and the request that triggered it
- a status (new, acknowledged, resolved, ignored) and an owner
In short, error tracking turns raw failures into a prioritised work queue. It answers "what is broken, since when, for how many people, and who is fixing it?"
Error tracking vs. logging: a comparison
| Aspect | Logging | Error tracking |
|---|---|---|
| Unit of data | Individual event (log record) | Grouped issue with many occurrences |
| Scope | Everything your code chooses to record | Exceptions, crashes, failed requests |
| Primary question | What happened, in what order? | What is broken, how often, for whom? |
| Context | Whatever fields the developer adds | Stack trace, release, environment, user and session, breadcrumbs |
| Deduplication | None by default; aggregation through queries | Built in through fingerprinting |
| Lifecycle | None; logs are records | Status, assignment, resolve, regression detection |
| Alerting | Queries and thresholds on patterns or rates | New issue, regression, spike in occurrences or affected users |
| Volume | High; often the largest telemetry signal | Lower; one issue per bug, sampled occurrences |
| Best for | Investigation, audit, business and security events | Finding, prioritising and fixing bugs |
Neither replaces the other. A stack trace tells you where the code failed; the logs and the trace around it tell you why the code got there, which input it received and which downstream call returned something unexpected.
Grouping and fingerprinting errors
Grouping is the core of error tracking. If grouping is too fine, one bug produces thousands of issues; if it is too coarse, different bugs hide behind one issue. Most systems compute a fingerprint from a combination of:
- Exception type, for example
TypeErrororjava.lang.NullPointerException - Normalised stack frames: module and function names of the in-app frames, usually without line numbers, since line numbers shift with unrelated edits
- Normalised message, with variable parts such as IDs, numbers, UUIDs, email addresses and timestamps replaced by placeholders
Message normalisation matters most for errors without a useful stack trace. These two messages should end up in the same issue:
Order 48213 not found for customer 7f3c9a1e-...
Order 51007 not found for customer 0b8d2e44-...
normalised: "Order <num> not found for customer <uuid>"
Customise the fingerprint where the defaults fail. Typical cases: a generic wrapper exception that should be grouped by the underlying cause, an HTTP client error that should be grouped by target service and status code, or a third-party library frame that should be ignored when grouping. Dedicated error tracking tools such as Sentry offer configurable fingerprinting rules for these cases, and most observability platforms allow similar grouping logic.
Stack traces: in-app frames and symbolication
A stack trace is only useful if it points at your code. Mark which frames are "in-app" (your packages or modules) and which belong to frameworks and libraries, so the issue view highlights the frame where your logic failed. For compiled and minified code, the trace must be symbolicated: mapped back to original file names, functions and lines. That means debug symbols for native code, ProGuard or R8 mapping files for obfuscated Android builds, and source maps for JavaScript.
Keep chained exceptions. In Java, Python and many other languages, an exception can wrap a cause (Caused by: in Java, __cause__ in Python). The root cause is often the most informative part and should be captured and shown.
Source maps for frontend JavaScript
Production JavaScript is bundled and minified, so a raw browser stack trace looks like at e (app.3f9a.js:1:48213). Source maps translate those positions back to the original source. A reliable setup:
- Generate source maps in the production build and give each build a unique release identifier, for example the Git commit SHA.
- Upload the maps to your error tracking or observability backend as part of the deployment, tagged with the same release. Do not rely on the backend fetching them from the public site.
- Decide whether to publish maps at all. Many teams do not deploy
.mapfiles publicly, or restrict access to them, because they expose the original source code. If you remove thesourceMappingURLcomment, the backend must match maps by release and file name. - Send the same release identifier with every frontend error event, otherwise the backend cannot pick the right map.
Also watch for errors reported only as Script error.. Browsers hide details of errors from cross-origin scripts unless the script is loaded with the crossorigin attribute and the server sends a matching Access-Control-Allow-Origin header.
Release correlation and regressions
The most important question after a deployment is "did we just break something?". Error tracking answers it if every error event carries the release and environment. In OpenTelemetry, these are resource attributes: service.version for the release and deployment.environment.name for the environment (older semantic convention versions use deployment.environment).
- New in release: issues first seen in the current release are the strongest signal for a bad deployment.
- Regression: an issue marked as resolved that reappears in a later release should reopen automatically and notify the owner.
- Spike after deployment: an existing issue whose rate rises sharply after a release is also a regression, even if it is not new.
Combined with deployment tracking, this lets you compare error rates before and after a release, or between the canary and the stable version, and roll back on evidence rather than gut feeling.
User impact: affected users and sessions
Occurrence counts are misleading on their own. One background job retrying in a loop can produce more events than a checkout bug that blocks hundreds of customers. Prioritise by impact:
- Affected users or sessions per issue, counted from a pseudonymous user ID or session ID, not from email addresses.
- Affected journeys: an error on the payment page matters more than one on a rarely used settings page.
- Share of requests: errors per endpoint relative to traffic, which relates directly to your error rate and SLOs.
For frontend issues, linking an error to the RUM session, and where privacy rules allow it, to a session replay, shows what the user did before the error appeared.
Noise control: ignore rules and rate limits
An error tracker that collects everything quickly fills with noise. Control it deliberately:
- Ignore known noise such as errors from browser extensions, bots, outdated browsers you do not support, or network aborts when users navigate away. Document every ignore rule, with a reason.
- Do not track expected outcomes as errors. A 404 for an unknown product or a failed validation is not a bug. OpenTelemetry semantic conventions reflect this: for server spans, 4xx status codes do not set the span status to error, 5xx codes do.
- Rate-limit and sample occurrences. Keep every new issue, but sample repeated occurrences of the same fingerprint beyond a limit, for example 100 events per minute per issue (example value), while still counting all of them.
- Snooze, don't delete. Snooze an issue until it exceeds a threshold or reappears in a new release, rather than ignoring it forever.
Linking errors to traces and logs via trace_id
An exception without context forces you to reproduce the problem. If the error event, the log records and the spans of the same request share a trace ID, you can move from the issue to the full request: which service called which, which query was slow, which downstream service returned the 500, and which log lines were written along the way.
With OpenTelemetry, record the exception on the active span and set the span status to error. In Python:
# example: recording an exception on the active span (Python, OpenTelemetry)
from opentelemetry import trace
from opentelemetry.trace import Status, StatusCode
import logging
tracer = trace.get_tracer("checkout")
log = logging.getLogger("checkout")
def capture_payment(order):
with tracer.start_as_current_span("capture_payment") as span:
span.set_attribute("order.id", order.id)
try:
return payment_client.capture(order.id, order.amount)
except PaymentError as exc:
span.record_exception(exc)
span.set_status(Status(StatusCode.ERROR, "payment capture failed"))
log.exception("payment capture failed",
extra={"order.id": order.id, "provider": "psp-a"})
raise
The same in TypeScript for Node.js:
// example: recordException and setStatus (Node.js, OpenTelemetry API)
import { trace, SpanStatusCode } from '@opentelemetry/api';
const tracer = trace.getTracer('checkout');
export async function capturePayment(order: Order) {
return tracer.startActiveSpan('capture_payment', async (span) => {
try {
return await paymentClient.capture(order.id, order.amount);
} catch (err) {
span.recordException(err as Error);
span.setStatus({ code: SpanStatusCode.ERROR, message: 'payment capture failed' });
throw err;
} finally {
span.end();
}
});
}
recordException adds an exception event with the attributes exception.type, exception.message and exception.stacktrace. In the Python SDK, start_as_current_span also records exceptions that escape the block and sets the error status by default. The OpenTelemetry project is moving towards recording exceptions as log records as well, so check the documentation of the SDK version you use. If logs and spans are not connected, or traces break off between services, our articles on structured logging and on incomplete distributed traces cover the usual causes.
Frontend vs. backend errors
| Aspect | Frontend (browser, mobile) | Backend (services, jobs) |
|---|---|---|
| Typical sources | window.onerror, unhandledrejection, failed fetch calls, crashes | Unhandled exceptions, 5xx responses, failed jobs, timeouts |
| Stack traces | Minified; need source maps or mapping files | Usually readable; need in-app frame marking |
| Environment noise | Extensions, old browsers, flaky networks, ad blockers | Retries, transient dependency errors |
| User context | Session, page, browser, device | Request, tenant, endpoint, pseudonymous user ID |
| Correlation | Trace context propagated on fetch and XHR to your own APIs | Trace context from incoming requests and messages |
A frontend error often has its root cause in the backend: the browser fails on undefined because an API returned an unexpected shape. That is why propagating trace context from the frontend to your APIs is worth the setup effort.
Workflow: triage, ownership and issue tracker
Error tracking only helps if issues reach someone who fixes them. A simple workflow:
- Triage daily. Review new issues and regressions, starting with the highest user impact. Decide for each: fix now, schedule, or ignore with a reason.
- Assign ownership automatically. Route issues to teams by service, code path or code owners file, so that nobody has to guess.
- Link to the issue tracker. Create a ticket from the issue with the stack trace, release, trace link and affected users, and keep the status in sync.
- Resolve in a release. Mark an issue as resolved in the release that contains the fix, so that the system can detect a regression if it reappears later.
- Escalate when it is an incident. If an error blocks a critical journey for many users, it is an incident, not a ticket. Our incident management process describes how to handle it.
How to log errors well
- Structured, not free text. Log errors as structured events with stable fields:
error.type,error.message, the stack trace,trace_id,span_id, service and release. - Log once, at the boundary. Log an exception where it is handled, not at every layer it passes through. Re-logging the same exception five times inflates volume and confuses counts.
- Add context, not secrets. Include the operation, relevant IDs and the downstream dependency. Never log passwords, tokens, full card numbers or request bodies with personal data, and apply PII masking in the pipeline as a safety net.
- Use the level consistently. ERROR for failures that need attention, WARN for degraded but handled situations. An expected validation failure is INFO or WARN, not ERROR.
- Keep the cause. When wrapping exceptions, keep the original cause so that the stack trace remains complete.
Frequently asked questions
Can I do error tracking with logs only?
Partly. With structured logs you can query and count errors by type, but you need to build grouping, release correlation, regressions and ownership yourself. That is the part error tracking provides out of the box.
Do I need a separate error tracking tool?
Dedicated tools such as Sentry focus on error tracking and are widely used. An observability platform with built-in error tracking keeps errors, traces, logs and metrics in one place. Which is better depends on how much you value that correlation versus a specialised tool; our Obseria vs. Sentry comparison describes the differences.
How do I find errors in production that users do not report?
Capture unhandled exceptions in every service and in the frontend, alert on new issues and regressions after each release, and review issues by affected users rather than by raw count.
Error tracking checklist
Use this checklist to review your error tracking and logging setup
- Unhandled exceptions captured in every backend service, job and frontend app
- Fingerprinting based on exception type, normalised in-app frames and normalised messages
- Custom grouping rules for wrapper exceptions and generic HTTP client errors
- In-app frames marked, chained causes preserved
- Source maps (and mapping files for mobile) uploaded per release, not necessarily public
service.versionand environment set on every event and span- Alerts for new issues in a release, regressions and spikes after deployments
- Issues prioritised by affected users and sessions, not only by occurrence count
- Ignore rules documented; expected 4xx outcomes not tracked as errors
- Rate limits or sampling for repeated occurrences, with complete counts
- Exceptions recorded on the active span with error status
- Error logs structured with
trace_idandspan_id, logged once at the boundary - No secrets or personal data in error messages and logs, PII masking in the pipeline
- Ownership routing and issue tracker integration in place
- Issues resolved in a release so regressions reopen automatically
How Obseria helps with error tracking
Obseria's error tracking groups exceptions from your services and frontends into issues and keeps them next to the traces, logs and metrics of the same requests, all OpenTelemetry-native. From an issue, you can open the trace in which the exception was recorded and the log lines that share its trace ID.
- Release and environment attributes connect issues to deployments, so new errors and regressions show up right after a release.
- Obseria Pipeline masks personal data and filters noisy error events before storage, and Obseria Lake keeps the full history queryable.
- Obseria Intelligence links error spikes to the change, dependency or infrastructure event behind them and shows the evidence, and alerts can open an incident with the relevant context.
To see your own exceptions linked to traces and logs, book a demo or start the 14-day free trial.