How To Write Good Log Messages
trottercashion.com
How To Write Good Log Messages
1–10 of 57 posts
Re: How To Write Good Log Messages
#2Re: How To Write Good Log Messages
#3pid - yes, knowing the process id is good, but knowing the thread is also useful.
version - outputting this on every single log line is probably overkill. Ditto for host name.
Re: How To Write Good Log Messages
#4http://blip.tv/carolinacon/logstash-open-source-log-and-even...
Re: How To Write Good Log Messages
#5Re: How To Write Good Log Messages
#6time is expressed in seconds? My computer does about 3 billion things every second. I think milliseconds or preferably microseconds would be much better. Different domains have different needs, though, I'm sure. Also, I'd prefer the log specify the time zone it thinks it's in, rather than just convert to UTC automatically. pid - yes, knowing the process id is good, but knowing the thread is also useful. version - out…
Re: How To Write Good Log Messages
#7Anyone have a good utility for managing JSON in log files?
Re: How To Write Good Log Messages
#8I know what the app does, I know the process flows involved but 'failed to covert X at MyClass:44' doesn't have enough context for me.
Also log levels - most developers over use warning and error levels and under uses debug and trace in my experience. It makes filtering out the noise harder.
Rolling log files - roll on an event (new day, process bounced etc.) not on reaching a 10Mb limit or an equally arbitrary 1k lines limit.
Use a header in the logfile, contain at least the version number of the code running, the user and host it is running on.
Lastly stack traces, if they even have a use case at all in production, should not be in the main logfile.
Re: How To Write Good Log Messages
#9I personally have found a lot of difficulty with JSON-based logs, because tools like `grep` and `cut` don't suffice; I usually have to write a more complex regex with `sed` in order to extract useful information I want. Anyone have a good utility for managing JSON in log files?
https://github.com/micha/jsawk/ https://github.com/ddopson/underscore-cli
Re: How To Write Good Log Messages
#10time is expressed in seconds? My computer does about 3 billion things every second. I think milliseconds or preferably microseconds would be much better. Different domains have different needs, though, I'm sure. Also, I'd prefer the log specify the time zone it thinks it's in, rather than just convert to UTC automatically. pid - yes, knowing the process id is good, but knowing the thread is also useful. version - out…
But my computer thinks it's clock is in UTC, and it only converts to a timezone for human readable dates.