Better Programming

Advice for programmers.

Follow publication

You're unable to read via this Friend Link since it's expired. Learn more

Member-only story

How To Use Structured JSON Logging in Golang Applications

Percy Bolmér
Better Programming
Published in
5 min readAug 9, 2021
Futuristic room
Photo by Alvaro Pinot on Unsplash

Sick and tired of going through unstructured logs to track down a bug? Ever tried forcing a team of developers to write down their error messages in a structured way? Well, you’ve come to the right place in your journey to stop bad software logs.

What Is Structured Logging?

Logging is a very important part of software. We do need logs to keep track of what’s going on in systems and as they grow large it becomes increasingly important.

There are many great tools out there that help us parse logs. I’m personally a great fan of ElasticSearch for instance. But these tools are most of the time depending on a structured log, not a plain text blob mass that may or may not be written in a certain format.

I remember when being assigned a bug to track down, the system had about 30 CRON jobs running some scripts, and all the scripts wrote their output to a single file which was rotated by date. So there was at least some kind of central logging (not the most recommended one, but hey). There were logs for this ancient system, so I went in, duct tape in hand; I was going to…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Percy Bolmér
Percy Bolmér

Written by Percy Bolmér

Software developer, Author/Blogger. Writes about Technology, Programming and Go. https://programmingpercy.tech/

Write a response