-
Notifications
You must be signed in to change notification settings - Fork 70
Proposal: Unstructured (pretty) log output to stdout/stderr #886
Comments
Thanks for sharing that screenshot/prototype. I think it would helpful to figure out our goals with making a change like this, and use that to guide a solution. Given a blank canvas, what would we like the output to look like, and what type of data should be included in it? My hope with adding unstructured logs is to remove much of the ship internals from the logs that are used by a ship cluster operator to make ship more approachable to a non-developer. Logging function names as a trace through the application is incredibly useful when working on Ship, but makes Ship harder to debug when something isn't working properly for the cluster operator user. I don't want to remove the logs as they are today, but I'm suggesting that we instead work to simplify them. In the screenshot attached, there are info-level steps (i'll ignore the debug level for now) of:
There's an argument to be made that these specific lines shouldn't be info-level, but they are, so I'm using them as the example. If there's another spot of the logging that makes more sense to discuss, let's attach some logs and take this same approach. I think the relevant information for an operator (not a ship developer) is:
I'm suggesting a different approach -- not just a log formatter, but thinking through logging from a cluster operator perspective, and how can we make the logs more clear, in addition to prettier. |
I think that makes sense. I'd llike to avoid is having to go through every single info+ level log statement and write a separate 'log-nicely-stdout' command. I wonder if we could build some kind of map 'event -> message'. Not only does that feel like a the right abstraction to me, but it sets us up for i18n nicely.
and so on |
I think you picked up on this -- the key thing architecturally is that if we focus on machine-readable, operable logging, we can build the formatting/templating on top of that easily, but going the other way would be trickier. |
Anyhow, prototype is up here. Disclaimer -- loaded with jank. |
@marccampbell should we consider removing timestamps in that case? |
Currently, when running
ship init
, the debug output is a somewhat difficult to grok. For example, when runningship init
on an app (in debug mode), I see:When something doesn't work properly, the Ship UI asks you to "look at .ship/debug.log" to diagnose. But this log format is hard to scan and hard to read without a decent understanding of the ship architecture and how it all should work.
The value of structured logging is great, and I don't propose removing it. I'd like to discuss changing the default log output to unstructured, human readable, possibly even color coded to be much more approachable. We should retain the structured log output in a way that can be used when running ship in a headless system such as CI and having a log aggregator pick up and centralize the logs, or when sending logs to for support. Ideally, stdout/err will show "pretty" logs, and structured logs will be stored on disk.
The text was updated successfully, but these errors were encountered: