Your application speaks in logs

An application today is a web app, a phone app, a few services, a queue, a database and the containers they run in. Each one says what it is doing in plain sentences. Read them together and the whole thing reads as one program.

3 min read

One application, many programs#

“The app” used to be one program you could stop in a debugger. Now a single click goes from a page to an API, from the API to a queue, from a worker to a database, and back, across processes, languages and containers. No debugger spans all of them, and each has its own window, its own terminal tab and its own log.

What they all have in common is that they talk. Every layer writes down what it is doing, in words:

web      GET /checkout → 200 in 41 ms
api      Order 42: applying BULK20 to 12 items
api      POST /payments → 502 from payments
payments Card declined for order 42: insufficient funds
worker   Retrying order 42 in 30 s (attempt 2 of 5)
postgres ERROR: duplicate key value violates "orders_pkey"

Read one at a time, each line is a fragment. Read in the order they were written, they are the story of what your application just did, told by every part of it. That is the layer worth looking at when something goes wrong: not one program’s variables, but the conversation between all of them.

Every layer, in one place#

WTFCode gathers each layer’s words where they’re already written. Nothing is installed in your code and no logging library is required: what a program prints is enough.

LayerSpeaks throughReaches you in
Your services and appsWhatever each runner prints, in any languageSuperlog, from the Run panel
Containersdocker logs of the ones you followSuperlog, merged by the engine’s timestamps (Docker)
The calls between themHTTP requests and answers on your MacLive wire, over the logs
A clusterEach pod’s containersThe Kubernetes log panel, merged or in swimlanes
The cloudCloudWatch, Cloud Logging, Log AnalyticsCloud, through its agent

Read it as one program#

  1. Start the pieces together.

    Run the services you work on from the Run panel, as a group if you always start them together. Follow the containers they need.

  2. Read the story in order.

    Merged timeline puts every line in the order it was written, each marked with who said it. This is the application as one program.

  3. Then read each speaker.

    Runner lanes gives each one a column, to see what one service did while the others went on.

  4. Follow one thing through every layer.

    Search for an order number or a request id: every line that names it, in every service, counted.

  5. Go from words to code.

    A stack frame in any language opens its file at the line. Where the words aren’t enough, Live wire shows the call itself, and the debug tools show the lines that ran.

Write logs that read well together#

Superlog reads any output. A few habits make yours read as a story:

  • Name the thing that crosses services. An order id or a request id in every line about it makes one search follow it everywhere.
  • One event, one line, in words. “Order 42 paid” reads better than a dump of the object.
  • Say where you listen when you start. A port in the first lines tells you, and Live wire, which service is which.
  • Leave stack traces whole. Every frame is a link back to your code.

Next steps#

Something unclear or out of date? Tell us; a person on the team reads every note.

Search every guide: features, settings, keys and troubleshooting.

Try