3 ms·
General rule: writing logs is a means, not an end, so whoever reads it most gets to decide what it should look like. Corollary 1: allow developers to use whate
by Someone 10y ago
General rule: writing logs is a means, not an end, so whoever reads it most gets to decide what it should look like.
Corollary 1: allow developers to use whatever they see fit for DEBUG logging.
Corollary 2: require single-line json for everything else (if your developers have to read lots of production logs, you probably have a bigger problem than your log format)
You will need something to have ops filter DEBUG lines out.
Options:
- disallow having DEBUG logging in production
- separate log file for DEBUG logging
- start each line with the log level
Also: give the developers a tool that converts the 'one json line per event' file to what they want. Configure less and other tooling to know about it.
Optionally, tweak the json serializer used in logging to always output the time stamp, severity, and short description at the start of the line.