liveBook · Manning

Log

As explained in Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform

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.2 section 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.

Also explained in

Compare how 14 books explain log →

Related concepts

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.