Günlükleri ve İzleri İlişkilendirme
Günlükleri iz bağlamına bağlayın.
Günlükleri ve İzleri İlişkilendirme, CoddyKit'te ücretsiz bir Spring Boot 4 Microservices & REST APIs dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Spring Boot 4 Microservices & REST APIs öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Spring Boot 4 Microservices & REST APIs kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
Linking logs to traces
Traces show the request flow; logs show the details. Putting the traceId into every log line lets you jump from a trace to its exact logs - and vice versa.
What is MDC?
MDC (Mapped Diagnostic Context) is a per-thread key/value map provided by SLF4J/Logback. Values placed in it can be printed in every log line by the layout pattern.
Micrometer populates the MDC
Micrometer Tracing automatically puts the current traceId and spanId into the MDC, so they are available to the logging framework without manual code.
Adding IDs to the log pattern
Reference the MDC keys in your Logback pattern so each line carries the IDs.
# logback-spring.xml pattern
# %d{ISO8601} [%X{traceId:-},%X{spanId:-}] %-5level %logger - %msg%nSpring Boot default pattern
Spring Boot can inject the IDs for you. Setting the application name enables the default correlation pattern that prepends [app,traceId,spanId] to logs.
spring:
application:
name: order-service
# logs become: [order-service,4bf9...,00f0...] INFO ...A correlated log line
The result looks like this - the bracketed IDs tie the line to a specific trace and span.
// 2026-05-30 10:00:00 [order-service,4bf92f35...,00f067aa...] INFO c.a.OrderService - Order placedSearching by traceId
With IDs in logs, your log aggregator (ELK, Loki, etc.) can filter by traceId. Copy an id from Zipkin, paste it into the log search, and see every related log line.
Custom baggage in logs
You can also surface baggage (e.g. tenant id) in logs by mapping a baggage field into the MDC, enriching every line with business context.
management:
tracing:
baggage:
correlation:
fields: tenantIdTwo-way navigation
The goal is bidirectional: from a slow span in Zipkin -> open its logs by traceId; from an error log -> open its trace in Zipkin. This dramatically speeds up debugging.
Keep IDs out of business logs by accident
Because IDs come from MDC, they appear only when a trace is active. Background threads without a trace context show empty IDs (%X{traceId:-} renders blank) - which is expected.
Structured logging
For best results emit logs as JSON with traceId/spanId as proper fields, so log tools can index and link them reliably instead of parsing text.
Quick Check
Test your correlation knowledge.
Recap
You correlated logs and traces:
- Micrometer puts
traceId/spanIdinto the MDC - Reference them in the Logback pattern (or use Boot's default)
- Search logs by traceId to jump between traces and logs
- Prefer structured JSON logs for reliable indexing
Sıkça Sorulan Sorular
“Günlükleri ve İzleri İlişkilendirme” dersi ücretsiz mi?
Evet — “Günlükleri ve İzleri İlişkilendirme” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Spring Boot 4 Microservices & REST APIs kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Spring Boot 4 Microservices & REST APIs kursu toplamda 4 dersten oluşur.
“Günlükleri ve İzleri İlişkilendirme” dersinde ne öğreneceğim?
Günlükleri iz bağlamına bağlayın. Spring Boot 4 Microservices & REST APIs ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
Spring Boot 4 Microservices & REST APIs öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te Spring Boot 4 Microservices & REST APIs, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.
“Günlükleri ve İzleri İlişkilendirme” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu Spring Boot 4 Microservices & REST APIs dersinde kod yazıp çalıştırabilir miyim?
Evet. Her Spring Boot 4 Microservices & REST APIs dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Dağıtık İzleme Neden Önemlidir
- Micrometer İzleme
- İzleri Zipkin'e Dışa Aktarma
- Günlükleri ve İzleri İlişkilendirme