Quick revision
The short answer
We write a short standard (structured JSON logs, required fields such as trace id, service and environment, agreed log levels, and a clear list of what never to log, such as secrets and personal data), then ship it as a shared Spring Boot starter so that following it is the default. Tracing uses Micrometer Tracing with the OpenTelemetry bridge so trace context propagates the same way everywhere, and we verify adherence with CI checks and dashboards that show missing fields per service, adjusting the standard with the teams as we learn.
What to remember
In this answer, we introduced a logging and tracing standard by keeping it short and concrete, with required fields, level meanings and a do-not-log list; shipping it as a starter built on Spring Boot's structured logging and Micrometer Tracing with OpenTelemetry; verifying it with CI rules and a dashboard of missing fields per service; and revising it with the teams based on what they find.
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.
We write a short standard (structured JSON logs, required fields such as trace id, service and environment, agreed log levels, and a clear list of what never to log, such as secrets and personal data), then ship it as a shared Spring Boot starter so that following it is the default. Tracing uses Micrometer Tracing with the OpenTelemetry bridge so trace context propagates the same way everywhere, and we verify adherence with CI checks and dashboards that show missing fields per service, adjusting the standard with the teams as we learn.
Why this question is asked
During an incident, the first question is usually 'what happened to this request across all the services it touched'. If each service logs in its own format, with or without a trace id, answering takes an hour of grepping. If they all follow one standard, it takes one search. Interviewers ask this to see whether we can introduce a standard that teams actually adopt and that we can check. In this answer, we will define the standard, put it into a starter, set up tracing propagation, build the checks that verify it, and look at how to keep it alive with feedback.
1A Quick Recap: Structured Logs and Traces
A structured log line is a JSON object instead of free text. Instead of 'Order 42 failed for user 7', the line has fields such as message, level, order_id and trace_id, so the log platform can filter and group by any field without fragile text parsing.
A trace follows one request through several services. Each service records a span, a timed unit of work, and all spans of one request share a trace id. The trace id travels between services in an HTTP header, normally the W3C traceparent header, or in Kafka message headers. If every log line also carries the current trace id, we can jump from a slow span to exactly the log lines it produced.
2Defining the Standard
The standard should fit on a page or two, with an example log line. It says that logs are JSON on standard output, lists the required fields and their names, defines what each level means, and lists what must never appear in a log.
| Field or rule | Example | Why |
|---|---|---|
| timestamp, level, message | 2026-11-06T10:15:02Z, ERROR | basic search and alerting |
service.name, service.version | orders, 1.42.0 | find the owner and the release |
| environment | prod | never mix test and prod logs |
| trace_id, span_id | 4bf92f3577b34da6... | join logs to traces |
| ERROR = needs action, WARN = degraded | not for expected 404s | alerts mean something |
| never log | passwords, tokens, card numbers, full personal data | security and privacy law |
3Making It the Default With a Shared Starter
A standard that each team must implement by hand will be implemented ten different ways. Instead, we publish a starter, for example company-observability-spring-boot-starter, which teams add as one dependency. Its auto-configuration sets the structured log format, fills in the service fields, adds tracing and installs masking for sensitive fields. Spring Boot 3.4 and later can write structured logs natively, which makes the starter small.
Notice that the trace and span ids appear without any code in the service. Micrometer Tracing puts them in the logging context (the MDC, a per-thread map of values that the logger adds to each line), and the structured format writes them out. Teams can still override a property if they have a good reason, but the default is the standard. Property names differ a little between Boot versions, so the starter, not each team, tracks them; check your version.
4Consistent Trace Propagation With Micrometer and OpenTelemetry
For tracing, the starter brings Micrometer Tracing with the OpenTelemetry bridge and an OTLP exporter, so spans go to whatever backend the company runs, through an OpenTelemetry collector. With Spring Boot 3.x that means the micrometer-tracing-bridge-otel and opentelemetry-exporter-otlp dependencies; Spring Boot 4 also offers an OpenTelemetry starter, so check your version.
The important part is that every service uses the same propagation format, W3C trace context, and the same instrumented clients. Spring's RestClient, WebClient and KafkaTemplate built from the auto-configured builders pass the trace headers automatically. A service that creates its own HTTP client with new RestTemplate() breaks the trace at that hop, and this is one of the things our checks should find.
6 messages in order. Play them, or step through them one at a time.
One search for the trace id returns every line from every service.
5Verifying That Teams Follow It
We verify in two places. In CI, a shared test or build check confirms that the service depends on the starter, that no code writes to System.out, and that no logger call includes fields on the deny list. An ArchUnit rule, a library that checks code structure in a unit test, can express some of these.
In production, a dashboard on the log platform shows, per service, the share of log lines missing a required field, for example lines without trace_id, and the share of lines that fail to parse as JSON. A service at 30 percent missing trace ids probably has a custom thread pool or client that loses the context. The dashboard turns adherence into a number that teams can see and fix, without anyone policing them.
6Reviewing With Teams and Adjusting
After a few weeks, we review the dashboard with the teams and ask what is awkward. Perhaps a field name clashes with an existing alert, perhaps the sampling rate is too low for a low-traffic service, perhaps masking misses a field. We update the starter, release it through the normal update pull requests, and note the change. Teams that see their feedback in the next release stay engaged; teams that see the standard handed down unchanged find ways around it.
7Follow-up questions
How do we stop personal data appearing in logs?
Through layers: the standard says what not to log, the starter masks known fields and patterns before writing, code review watches for logging whole request objects, and a scheduled scan of log samples looks for patterns like card numbers or email addresses. When something leaks, we fix the code and the masking rule, and treat it as a privacy incident if required.
Why sample traces instead of keeping all of them?
Tracing every request at high traffic costs a lot of storage and network. Sampling, for example 10 percent, keeps a representative picture. Logs still carry trace ids, and many backends support tail-based sampling at the collector, which keeps all traces with errors or high latency.
What about services that are not on Spring Boot?
We publish the standard independently of the starter, and provide equivalents where we can, such as the OpenTelemetry Java agent and a logging configuration file. The dashboard checks the output, not the framework, so it covers every service.
8Conclusion
In this answer, we introduced a logging and tracing standard by keeping it short and concrete, with required fields, level meanings and a do-not-log list; shipping it as a starter built on Spring Boot's structured logging and Micrometer Tracing with OpenTelemetry; verifying it with CI rules and a dashboard of missing fields per service; and revising it with the teams based on what they find.
Open with
I'd write a short standard first: JSON logs to standard output, required fields like timestamp, level, service name and version, environment, trace id and span id, clear meanings for ERROR and WARN, and an explicit list of what never to log, such as passwords, tokens, card numbers and personal data.
Then, if they want more
Then I'd make it the default by putting it into a shared Spring Boot starter. Since Boot 3.4 there's native structured logging, so the starter mostly sets the format, fills in service fields and adds masking.
For tracing, the starter brings Micrometer Tracing with the OpenTelemetry bridge and an OTLP exporter, so every service propagates W3C trace context the same way and trace ids show up in the logs automatically through the MDC.
To verify, I'd check in CI that the starter is present and that code doesn't write to System.out, maybe with ArchUnit, and in production I'd have a dashboard per service showing the share of log lines missing trace ids or failing to parse. That points straight at services with broken propagation, like a hand-built HTTP client.
Finally, I'd review the results with teams after a few weeks and adjust the starter based on their feedback.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Spring Boot 3, Spring Boot 3.4, Spring Boot 4
- 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 "How would you introduce a common logging and tracing standard across services owned by...": https://scrivio-interview-library.netlify.app/architecture/platform-and-governance/f4e33aa3c7/