QA Interview Hub · Knowledge base · Quizzes · Українська
14 Logs and observability questions that come up in QA interviews, with short answers. Open the topic in the knowledge base for a deeper explanation.
The browser console shows JavaScript errors, warnings and console.error calls. The Network tab shows the page’s requests: method, URL, status, headers, request and response bodies, timing; the status hints where to look next: 5xx means a server failure, while 4xx is more often about the request data or authorization. Server logs give the cause: a stack trace, a message and context. I find the entry by time and by the request identifier (request id or correlation id) if the response has one. In the bug report I attach the relevant log fragment, the status and response body, and the time of the event, and I hide passwords and tokens.
TRACE — the most detailed flow, off; DEBUG — developer details, usually off in production; INFO — meaningful normal events; WARN — odd but handled (a retry, a deprecated API); ERROR — an operation failed; FATAL — the application cannot continue. The threshold is configuration: at INFO lower levels are not visible, so "nothing in the logs" can mean the level is off. Expected user rejections are not ERROR.
Structured (usually one JSON per line) gives fields that are filtered and aggregated without regexes: "checkout errors over an hour by code". The message is kept stable and variable parts go into fields; the stack trace goes in one field, one event is one line; field names are consistent (traceId, userId). Plain text is comfortable for a human locally. For an automated test structured logs allow finding an entry by a field instead of a substring.
I record the exact time (with the zone) and the environment, and reproduce. In DevTools I check Console and Network: the request went out and returned 5xx — backend; no request or a JS exception — frontend; 4xx — data or authorisation. I take the request/trace id from the response and look for entries in backend logs. I look for the first error in the chain, since the rest is a cascade, and check what came before it (WARN, a deploy, config).
Steps, expected and actual result; the environment and build version; the exact time with the time zone; the request/trace id; a log excerpt around the error without secrets; a screenshot or HAR/trace. An excerpt is better than a link to an entry that will vanish with retention.
Metrics are numeric time series (RED: rate, errors, duration), cheap, for dashboards and alerts; they say what and how much. Traces are the path of one request through services as spans with durations; they say where. Logs are individual events with context; they say why. Investigation: a metric alert → a trace finds the slow or failing span → the logs for that trace id explain the cause.
W3C Trace Context: traceparent = version-trace id (32 hex)-parent span id (16 hex)-flags, for example 00-4bf9…4736-00f0…02b7-01 (01 means sampled). Services pass it on, so the whole chain shares one trace id. If every log entry carries the trace id, one search finds the trace and all related logs of all services. A test can generate a traceparent itself and later investigate its own failure by it.
An SLI is a measurable figure (the share of successful requests, the share of responses faster than 300 ms). An SLO is a target for the SLI over a period (99.9% over 30 days). An SLA is an external contract with consequences. Error budget = 100% − SLO (0.1%): while it is unspent, changes ship fast; after that reliability comes first. A QA checks that key scenarios are covered by metrics and alerts, uses SLOs as a release criterion (canary, rollback), adds synthetic tests and a test for every missed incident.
docker logs -f --tail 100 --since 10m <container>; docker compose logs -f --tail=50 <service>; kubectl logs deploy/<name> --since=15m, -c <container>, -l app=<label> --prefix, --previous for a container that crashed. Files: tail -f app.log | grep --line-buffered ERROR, grep -n -C 3 <id> app.log. JSON: jq -c 'select(.level=="error")' app.log. In PowerShell: Select-String and Get-Content -Wait -Tail.
Sentry is an error tracker: it collects frontend and backend exceptions, groups them into issues by stack trace, and shows breadcrumbs, environment, release and the number of affected users; with source maps the stack traces are readable. It answers "is this error new in this release and how widespread is it". Centralised logs (ELK, Loki, Datadog) give the full picture of events, including non-errors. The tools complement each other.
An auto fixture: before navigation subscribe to page.on('pageerror', e => …) and page.on('console', m => …) filtering m.type() === 'error', collect into an array, and after await use(errors) call expect(errors).toEqual([]). Add a narrow allowlist of known third-party noise with a comment. Negative scenarios expect the error explicitly. You can also listen to requestfailed and to response with a status ≥ 500.
Save the services' output (docker compose logs --no-color --timestamps > server.log) and upload it as an artifact with the upload-artifact step using if: !cancelled() (or always()), because after a failure steps are skipped by default; keep retention-days short. Every test request carries a traceparent/X-Request-Id that is added to the report (testInfo.annotations or testInfo.attach) so the needed entries can be found quickly.
Yes — when a log is part of a requirement (audit, security, "a secret is not in the logs"): search by structured fields and a unique id, and wait with expect.poll/toPass because logs arrive with a delay. No — when the check is for exact message text, line order or DEBUG: refactoring breaks the test with no behaviour change. What matters to the business is better exposed as an event or a metric with a contract.
Passwords, tokens and API keys, full card numbers and CVV, authentication bodies, personal data (email, phone, address). Control: masking in the logger or OTel Collector, logging an internal id instead of an email, an allowlist of fields, DEBUG off in production, restricted access to logs. A QA checks after login, payment and password reset that nothing sensitive is in logs and error bodies, and that secrets are masked in CI (derived values such as base64 are not masked by GitHub).