Lesson 23 of 30
Once code is running in front of real users, `console.log` and a debugger stop being enough — observability is being able to answer 'what actually happened' after the fact, for a user you can't reproduce the bug in front of.
12 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
Question 1 of 2
A production error is logged simply as "Error occurred". Why is this close to useless for actually fixing the bug?
Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
Logging records discrete events as they happen ("user 42 clicked checkout," "API call to /orders failed with 500"). Monitoring watches aggregate metrics over time (error rate, page load time, requests per second) and can alert when something crosses a threshold. Observability is the broader property: can you answer a new, previously-unasked question about your system's behavior using the data you already collected, without shipping a new debug build?
try {
await submitOrder(order);
} catch (err) {
logger.error("order_submit_failed", {
userId: user.id,
orderId: order.id,
error: err.message,
// enough context to actually investigate, not just "something broke"
});
throw err;
}
Logs: discrete events — "user 42 checked out at 10:03am." Good for "what exactly happened here."
"A user reports a bug you can't reproduce — how do you investigate it?" is a real, practical scenario, and the honest answer routes through observability tooling (error tracking with context, structured logs) rather than "ask them to describe it more."