Beware of Using JSON.stringify() for Logging

John Mills
Level Up Coding
Published in
3 min readAug 23, 2020

--

String on a fence
Photo by Rosie Kerr on Unsplash

Recently I was working on a legacy system built on AWS Lambda and Node.js. It uses the console object along with JSON.stringify() to log messages and data to AWS CloudWatch.

The log messages often contain helpful clues that assist with troubleshooting issues, particularly when they only show up in the production environment.

--

--

John is a software developer living in Wellington, New Zealand. He writes about code, tech, travel & “ancient” New Zealand.