QA Interview Hub · Knowledge base · Quizzes · Українська

Logs and observability › Logs for a QA

What a log entry holds and what the levels mean

A log entry has a time, a level, a source, a message and context, and the level says how serious the event is. Time is written in UTC per ISO 8601. The logger has a threshold: entries below it are dropped, so a missing entry does not prove the event did not happen. Expected situations such as a wrong password are INFO or WARN, while ERROR is for an operation that failed.

Logs · Basics

A test failed, and the logs are clean. Was there really no error?

A user complains that a payment "hung". The logs for that time have no ERROR, and the suspicion falls on the tester: "cannot reproduce". An hour later it turns out that a catch block caught the gateway exception, wrote an INFO line and moved on. The log existed, it just had the wrong level and the wrong fields. This lesson covers what a log entry consists of, what each level means, and how to tell "there was no error" from "the error was not recorded".

How it works and why. A log entry is a structure of several fields. The event time is best written in UTC per ISO 8601 / RFC 3339 with milliseconds (2026-10-12T09:14:03.512Z): local time without a zone gets confusing when you investigate across servers. The level (severity) says how serious it is. The source: service, instance, class, thread. The message: what happened. The context: a request id or trace id, an internal user id, an error code, a stack trace.

2026-10-12T09:14:03.512Z ERROR checkout-7d9f [http-4] Payment failed
  orderId=8841 traceId=4bf92f3577b34da6a3ce929d0e0e4736
  GatewayTimeoutException: no response in 3000 ms

The levels are ordered, and a logger has a threshold: entries below it are dropped before output. This exists so production does not pay storage and CPU for every step. The threshold is set in the logger configuration and can differ per package: the payments service on INFO, the HTTP client library on DEBUG. So "nothing in the logs" often only means the needed level is switched off in this environment. Names differ a little between libraries (Python has CRITICAL, java.util.logging has SEVERE and WARNING, syslog defines eight levels in RFC 5424), but the order and the idea are the same.

Levels and the threshold

FATALthe app cannot continueERRORan operation failed, needs attentionWARNodd, but the system copedINFO ← typical prod thresholdmeaningful lifecycle eventsDEBUGdeveloper details: not visibleTRACEevery step: not visible
Figure 1. With an INFO threshold, DEBUG and TRACE are filtered out before writing. To see them, the threshold is lowered temporarily for the needed package.

Example: an error nobody saw. The starting code:

try {
  gateway.charge(order);
} catch (Exception e) {
  log.info("failed");      // not ERROR, no id, no stack trace
}

Three defects: the exception is swallowed (the code goes on as if all is well), an INFO level will not trigger an ERROR alert, and the message has neither the order nor the stack. The fix:

try {
  gateway.charge(order);
} catch (GatewayTimeoutException e) {
  log.error("Payment failed orderId={} traceId={}",
      order.id(), traceId, e);   // exception as the last argument
  throw e;
}

Now the entry carries context for searching, an exception with its stack, and lands in ERROR. The exception is rethrown, so the caller decides what to do, and the log does not replace error handling. A tester checks exactly this: provoke a failure (an unreachable gateway in a test environment) and see what appears in the logs.

Which level for which event.

EventLevelWhy
A user typed a wrong password (401)INFO / WARNan expected situation, not a system failure
The gateway did not answer, the retry succeededWARNthe system coped, but it signals instability
The payment failed after all retriesERRORthe operation was not completed, attention needed
Required configuration cannot be read at startupFATAL / ERRORthe service cannot continue

Limits and alternatives. Levels are a team convention, not a law: somewhere INFO is noisy, somewhere ERROR is logged for every 404. So QA checks the service’s real practice, not the textbook one. A log is also not guaranteed to be complete: a threshold, sampling and losses when a container restarts mean a missing entry does not prove the event did not happen. For "how many" and "how fast", metrics are more reliable, and for a request path across services, traces.

Typical mistakes.

  • A swallowed exception: the logs are clean while the user sees a failure.
  • Validation rejections (400) at ERROR level: the noise hides real failures and people stop reading the alert.
  • A stack trace without context (no order or request id): there are thousands of entries and the needed one cannot be found.
  • Time without a zone: a gap of hours against the server’s UTC.
  • A password, token or full card number in the message: a leak through the logs.

Check yourself

A service runs with an INFO threshold. A developer says "the detailed log exists", but you cannot see it. What do you check first?

Answer

The level of that entry. If it is DEBUG, the INFO threshold dropped it before output. Lower the level for the needed package in the test environment (logger configuration or an environment variable) and reproduce the failure again. Old entries will not appear: dropped entries are not stored.

A user typed a wrong password and the service wrote an ERROR with a stack trace. A defect or the norm?

Answer

More likely a logging defect: this is an expected scenario, not a system failure. Alerts are set on ERROR, so thousands of wrong passwords create noise and hide real errors. INFO or WARN without a stack is enough, ideally with a counter in the metrics to detect password guessing.

In an interview. Junior: A log holds a time, a level, a source, a message and context. Levels run from TRACE to FATAL, and the threshold decides what is visible. I check that an error really lands in ERROR and that the entry has no passwords. Middle/Senior: Beyond that I look at the service’s practice: whether exceptions are swallowed, whether expected validation pollutes ERROR, whether a request id exists to link to a trace, whether time is in UTC. I know a missing entry does not prove the event did not happen (threshold, sampling, loss on restart), so for quantitative questions I use metrics.

More articles in this chapter