Quick revision
The short answer
Logs were the main observability tool because for a long time nothing else existed; today metrics and traces answer most questions about rate, latency and dependency failures more cheaply, so logs should be reserved for rare, detailed context such as errors, decisions and state changes, while high-volume per-request logs are mostly cost. Structured events with a consistent schema blur the line between logs and traces, and OpenTelemetry unifies the pipeline, so I would invest in correlation, schema and sampling rather than more storage, charge teams for volume to steer behaviour, and keep business audit records out of observability tooling as data with their own guarantees.
What to remember
In this answer, we saw that logs dominated because they were once the only signal, and that today metrics answer how much, traces answer where, and logs are best kept for rare, detailed context such as errors, decisions and state changes. Structured events and OpenTelemetry blur the boundaries and unify the pipeline, so investment should go into correlation, schema and sampling rather than storage, with volume costs shown and charged to teams, while business audit records leave observability tooling and are treated as data with their own guarantees.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Logs were the main observability tool because for a long time nothing else existed; today metrics and traces answer most questions about rate, latency and dependency failures more cheaply, so logs should be reserved for rare, detailed context such as errors, decisions and state changes, while high-volume per-request logs are mostly cost. Structured events with a consistent schema blur the line between logs and traces, and OpenTelemetry unifies the pipeline, so I would invest in correlation, schema and sampling rather than more storage, charge teams for volume to steer behaviour, and keep business audit records out of observability tooling as data with their own guarantees.
Why this question is asked
Twenty years ago, a Java application server wrote synchronous lines to a file, and an engineer with SSH access read them with grep. Today services emit structured events that are shipped, indexed and kept centrally, next to metrics and distributed traces. Spending followed the habits: many companies now spend more on log storage than on any other observability signal, often without knowing what questions those logs answer. Interviewers ask this question at the most senior level to see whether we can explain how we got here and set a direction for investment. In this answer, we will look at why logs became the default, what each signal is best at today, how structured events and OpenTelemetry change the picture, where to invest, how to steer teams, and why audit records need a different home.
1Why Logs Were Everything
In the early days of Java services, logs were the only signal most teams had. There was no cheap metrics system and no distributed tracing. If we wanted to know how many orders failed, we counted lines; if we wanted to know how long a call took, we logged the start and the end and subtracted. So every question was answered with a log line, and habits formed around that: log every request, log every step, keep everything just in case.
Those habits survived the arrival of better tools. Many services still log a line per request at INFO, which made sense in 2006 and is mostly cost today.
2What Each Signal Is Best At Today
Metrics are numbers aggregated over time: request rate, error rate, latency percentiles, queue depth. They are cheap because their cost depends on the number of distinct series, not on traffic, so a service handling a million requests a minute costs the same to measure as one handling a thousand. They answer 'is something wrong and how much' better than any log query. Traces follow one request across services, showing which dependency was slow or failed, and sampling keeps their cost bounded. They answer 'where'.
Logs remain the best tool for 'why' in the cases that are rare and detailed: an error with its stack trace and context, a decision such as why a pricing rule was chosen, a state change such as a circuit breaker opening or a configuration reload. Those events are low in volume and high in value. The per-request 'it worked' line is high in volume and low in value, because metrics and traces already say it worked.
| Signal | Best for | Cost grows with |
|---|---|---|
| Metrics | is it wrong, how much, trends | number of series |
| Traces | where in the call chain | traffic times sample rate |
| Logs | why: errors, decisions, state changes | traffic times lines per request |
| Audit records | who did what, provably | business actions; kept as data |
3Structured Events and OpenTelemetry Blur the Lines
Once a log line is a structured event with a trace id, span id, service name and typed fields, it is very close to a span event in a trace. Some teams now emit one rich 'wide event' per unit of work, with dozens of fields, and derive both metrics and traces from it. The distinction between signals becomes a question of how we sample, store and query, rather than of separate tools.
OpenTelemetry makes this practical. Its specification defines logs, metrics and traces with shared resource attributes and context, its Java agent and SDK can bridge existing SLF4J and Log4j2 logging so log records carry the active trace context, and its Collector can receive, process, sample and route all three signals in one pipeline. For a company, that means one set of collection infrastructure, one schema for resource attributes and the freedom to change back ends without changing application code.
- ApplicationSLF4J or Log4j2 API, Micrometer, OpenTelemetry tracing
- SDK or agentshared resource attributes and trace context on every signal
- Collectorreceive, enrich, mask, sample, rate-limit, route
- Back endsmetrics store, trace store, log store, chosen per signal
- Separate pathaudit and business records, outside observability
5 layers, from the top down. Step through them one at a time.
4Where I Would Invest, and How to Steer Teams
With limited budget, I would invest in three things rather than more storage. Correlation first: every log carries trace and span ids, every dashboard links from a metric spike to example traces to the logs of those traces. That makes small amounts of logs far more useful. Schema second: one agreed set of field names, OpenTelemetry semantic conventions or ECS, enforced by the shared libraries, so every query and alert works across services. Sampling third: keep all errors and slow requests, sample routine success, and apply it consistently in the collector so the decision is made once.
To steer behaviour, teams must see what their logs cost. A monthly report per team of log volume and cost, and eventually a chargeback against their budget, changes habits faster than any guideline. It works best combined with tools that make reduction easy: a list of each service's top message templates by volume, with suggestions for which could be metrics.
5Keep Business Audit Records Out of Observability
One thing should move in the other direction. Over the years, many companies let business records drift into logs: order confirmations, payment results, access to customer data. Observability tooling is designed to be lossy and short-lived: it samples, rate-limits, drops under pressure and deletes after weeks. Those properties are right for telemetry and wrong for records the company must be able to prove.
So the strategy should treat audit and business records as data with their own guarantees: a defined schema, durable delivery, retention set by legal, controlled access. Once they are separate, we are free to sample and cut operational logs aggressively without any compliance worry, which is what makes the rest of the strategy safe.
6Follow-up questions
How would you decide to cut log volume by 80 percent safely?
Start with data: group a month of logs by service and message template, because a small number of templates usually make up most of the volume. For each top template, check whether any alert, dashboard or saved search uses it; the log platform's own query logs show this. Templates nobody queries, and per-request success lines that metrics already cover, are cut or sampled first. Keep all errors, warnings and state changes. Make the changes in stages, for example 30 percent per month, and watch incident investigation time and on-call feedback after each stage. If an investigation suffers, restore that template or raise its sample rate.
Will logs disappear entirely in favour of traces?
Unlikely. Errors with context, decisions and state changes, and events from places traces do not reach, such as start-up, batch jobs and background threads, will keep needing logs. What changes is that logs become fewer, more structured and linked to traces, rather than the primary record of everything.
Is OpenTelemetry mature enough to base the strategy on?
For traces and metrics it is widely used in production; logs support arrived later, and maturity differs by language and component, so check the current status for Java and your back end. A sensible plan uses the Collector as the pipeline now, bridges existing logging libraries, and adopts newer parts as they stabilise, which keeps the application code independent of the vendor in either case.
7Conclusion
In this answer, we saw that logs dominated because they were once the only signal, and that today metrics answer how much, traces answer where, and logs are best kept for rare, detailed context such as errors, decisions and state changes. Structured events and OpenTelemetry blur the boundaries and unify the pipeline, so investment should go into correlation, schema and sampling rather than storage, with volume costs shown and charged to teams, while business audit records leave observability tooling and are treated as data with their own guarantees.
Open with
Logs became the main tool because for a long time they were the only one: we counted lines to get error rates and subtracted timestamps to get latency, and those habits stayed.
Then, if they want more
Today metrics answer how much and whether something is wrong far more cheaply, because their cost depends on the number of series and not on traffic, and traces answer where in the call chain. So I see logs as the place for rare, detailed context: errors with their context, decisions and state changes.
High-volume per-request lines that say it worked are mostly cost. The lines between signals are also blurring: a structured event with trace ids is almost a span event, and OpenTelemetry gives one pipeline for all three signals with shared attributes, so we can sample, mask and route centrally and change back ends without touching code.
For investment, I'd put money into correlation, so every log carries trace ids and dashboards link metric spikes to traces to logs, into one schema, and into consistent sampling, rather than into more storage. To steer behaviour, teams see and eventually pay for their log volume, with tooling that shows their top templates and which could be metrics.
And I'd move business audit records out of observability entirely, because telemetry is designed to be lossy and short-lived, while audit records need guaranteed delivery and legal retention. Once that's separate, we can cut operational logs safely.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Over 20 years, logging moved from synchronous file writes on application servers to...": https://scrivio-interview-library.netlify.app/java/java-logging/64fcabe6bf/