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

Logs and observability › Logs for a QA

Where to find logs and how to localise a bug with them

A bug is localised from the user inward: Console and Network, then backend logs by request id. A 5xx points to the server, while a 4xx most often points to data or authorisation. Later ERRORs are usually a cascade, so the earliest error with the same id is sought. A bug report includes the environment, the time with its zone, the request id and a short log excerpt without secrets.

Logs · Investigation

The "Pay" button gives an error. Where do you look for the cause: the browser or the server?

A tester sees "Try later" after paying. Opening the whole cluster and scrolling the logs makes no sense: there are thousands per minute. There is a short route that in most cases shows within a few steps where it breaks: the frontend, the request or deeper in the services. This lesson covers where logs live in different environments and how to localise a bug with them so that a developer can reproduce it without clarifications.

Where the logs live.

  • Browser: DevTools → Console (JS exceptions, console.error, resource load errors) and Network (statuses, bodies, headers).
  • Backend: container stdout/stderr (docker logs, kubectl logs), files on a server and, in mature systems, a central store (ELK/OpenSearch, Loki, Datadog).
  • CI: the job console and artifacts (service logs, reports, traces).
  • Mobile: Android: adb logcat and the Logcat window in Android Studio. iOS: the Xcode console, the Console app and the log tool; for a simulator xcrun simctl spawn booted log stream. Crash reports are collected by services such as Crashlytics or Sentry.

How it works and why. A user request passes several layers: browser, gateway, services, database. Each layer writes its own log, and an error in one produces a cascade in the next. So the route goes from the user inward and stops at the first error in the chain. What was written last (dozens of ERRORs from different services) is mostly consequences. The link between layers is held by a request identifier: without it you match entries by time and guesses.

The investigation route

1. Record time and environmentwith the zone, build version2. Console and Network in DevTools5xx, 4xx, a JS exception?3. Take the request id from the responseX-Request-Id or trace id4. Find backend entries by the idservices that touched the request5. Find the FIRST errorand what came before: WARN, a deploy
Figure 1. Steps 1-3 are done in the browser and the test client, steps 4-5 in the backend logs.

Example: from "Try later" to the cause. In Network the POST /api/payments request returned 504, and the response header has X-Request-Id: 7c1e5a90. This already says the frontend did its part (the request went out) and the problem is deeper: 5xx means the server side, while 4xx is more often about data or authorization. In the log store a filter on this id and the time gives a chain:

09:14:00.470 WARN  checkout   retry 1/2 gateway=acme reason=timeout
09:14:03.512 ERROR checkout   gateway timeout 3000 ms orderId=8841
09:14:03.515 ERROR api-gw     upstream checkout returned 504

The last entry (ERROR in api-gw) is a consequence. The first error is in checkout, and before it a WARN about a retry. The cause is an unstable payment gateway, not the UI. Such a report already points to a service. For comparison: without an id the tester writes "payment does not work", and the developer spends an hour among thousands of entries.

What to add to a bug report.

Steps: pay for an order by card 4242 in staging
ER: status "Paid". AR: error "Try later"
Environment: staging, build 2.14.0, 2026-10-12 09:14:03 UTC
Request: POST /api/payments -> 504, X-Request-Id: 7c1e5a90
Log (shortened): checkout ERROR gateway timeout 3000 ms orderId=8841
First in the chain: WARN retry 1/2 ~3 s earlier

Here each line saves a question: the environment with a build, time with a zone, the request id and a shortened log excerpt. The excerpt is cut to a few lines around the first error, with secrets and personal data removed.

Mobile logs. Device logs are mixed with system noise, so they are narrowed:

adb logcat -v time *:W          # Android: WARN and above
adb logcat -c                    # clear the buffer before reproducing
adb logcat --pid=$(adb shell pidof -s com.example.shop)

Limits and alternatives. The route does not work if the logs are not there: a threshold that is too high, logs on a pod that is already deleted, short retention. Then the bug is reproduced with a raised level and the logs are collected at once. If the backend in a stand is shared, other people’s requests land in the results: narrow by id. For rare failures it is more reliable to have an alert and a trace than to hope someone opens DevTools in time.

Typical mistakes.

  • Taking the last error instead of the first: treating a consequence.
  • Forgetting the time zone: the logs use UTC, the report uses local time, and the entry "cannot be found".
  • A screenshot of the error without a request id and time: the developer cannot match it to the logs.
  • Pasting a log with a token or personal data into a bug report.

Check yourself

In Network the request returned 400 and the console has no exceptions. Where to look next: the frontend or the backend?

Answer

The request reached the server and was rejected. This is often data or authorization, so first the response body with the error description and the request body itself (what the client sent). Then, by request id, see why the backend rejected it. If the request body is wrong, the cause is on the frontend; if it is correct and the 400 is wrong, it is on the backend.

The log search shows dozens of ERRORs from different services within one second. Which do you start with?

Answer

With the earliest one by time carrying the same request id. The others are usually a cascade: a client service failed because a dependency returned an error. Then look at what came before the first one (WARN, retries, a deploy, a configuration change) to understand not only what but why.

In an interview. Junior: I reproduce the bug, record the time with a zone, look at Console and Network, take the request id and search for it in the backend logs. In the report I add steps, environment, time, the id and a log excerpt. Middle/Senior: I look for the first error in the chain, not the last, and check what came before it. By status I distinguish: 5xx is the server, 4xx is most often data or authorization, a missing request or a JS exception is the frontend. If there are no logs, I raise the level, reproduce and collect again, and also check that services pass the request id on.

More articles in this chapter