2 ms·
“Good logging” is mentioned here. Can somebody recommend a good write-up of what good logging consists of?
by pindab0ter 4y ago
“Good logging” is mentioned here. Can somebody recommend a good write-up of what good logging consists of?
- sethammons 4y agoI've wanted to do that for a while. Look into structured logging. I want/need machines to analyze my logs, and that requires key value pairs. I put any dynamic text in its own field. "error for user 42, remote api timed out" -> level: error, userid: 42, message: api timeout, http_request: <curl call to reproduce>, timestamp: <curr_time>, time_duration_ms: 30000, ... (but as json). Now I can see what users are affected by which errors however often. Alerts are now trivial to implement. They key is being able to debug an issue after the fact. I like to include a copy-pastable curl call when I can so I can manually reproduce an issue easily as an example
- pindab0ter 4y agoThis is great. We use Sentry for our projects, which serves the same purpose. I was wondering if using info statements in certain places are seen as a good practice, for example.
- 0cf8612b2e1e 4y agoThe curl request log is a very interesting idea I have never seen before. Do you have a library recommendation or did you implement something yourself?