Logging is the practice of recording runtime events, messages, and diagnostic information generated by software.
Logging records important events and actions as a text stream, creating a history that can help reveal what happened when a microservice has a problem. It supports monitoring and debugging alongside error handling, health checks, and observability. section 11.2section 11.2.1
Add logs deliberately:
Record pertinent events and the success or failure of important operations. section 11.2.1
Avoid secrets, sensitive information, personal details, and details that are easy to obtain elsewhere. Remove entries that add no useful information. section 11.2.1
Use standard output for ordinary messages and standard error for errors. Direct console logging can be effective without a more sophisticated logging system. section 11.2.1
Collect and search logs
Docker Compose can aggregate output from multiple microservices into one terminal stream. Redirecting that output through tee can display it while saving it to a file such as debug.log; search the file for terms such as “database” to investigate a problem. section 11.2.3
kubectl logs <pod-name>
Retrieve a microservice's logs from Kubernetes by substituting the pod's actual name. section 11.2.4
How Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform covers it
How deep it goes
Explains console output, log selection, aggregation, and retrieval without requiring a sophisticated logging system.
Examples
Shows console output, Docker Compose log capture and search, and Kubernetes pod-log retrieval.
What it assumes
Assumes a running microservice and, for remote retrieval, an authenticated kubectl connection.
What you can do after
Operate Docker Compose, kubectl, or Stern to collect and inspect microservice logs.
How it connects
Connects logging with monitoring, debugging, error handling, health checks, and observability.
Learn Go with Pocket-Sized ProjectsA structured log message represents log information as machine-parseable fields with defined meanings rather than as unstructured prose.
MongoDB 8.0 in Action, Third EditionLogging is the systematic recording of system activities, user actions, and application events for later review and analysis.
Proxyused by · A JavaScript Proxy is an object that intercepts operations on a target object through trap functions defined by a handler.
cybersecurity forensicsused by · Cybersecurity forensics is the systematic collection, preservation, and analysis of digital evidence to reconstruct events and investigate security-related activity.
monitoringkind of · Monitoring is the ongoing observation and measurement of a system’s behavior, state, or operational signals to assess its condition and detect changes or problems.
unstructured loggingcontrasts with · Unstructured logging records application events as free-form human-readable text without a predefined schema or standardized queryable fields.
observabilitypart of · Observability is the ability to infer a system’s internal state and behavior from its externally available outputs, such as logs, metrics, and traces.
JSONuses · JSON is a standardized, language-independent text format for representing structured data using objects, arrays, strings, numbers, Boolean values, and null.
This explainer was generated by Manning's knowledge graph from the text of Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform. The section links point to the parts of the book it draws on.