4 ms·
Logging in Ruby: (Almost) Everything You Need to Know
- lijok 3y agoHow can a log level be unknown?
- davetron5000 3y agoBased on how it is implemented, it probably should've been called `trace` because it is one level below debug.
- software_writer 3y agoIt could be useful for logging messages that don't fit a particular category, i.e. a catch-all category, to identify patterns over time. Edit: You could also use it to turn-off logging for a while. Since unknown is the highest level, no other logs would be recorded.
- xyproto 3y agoCan you give an example of a log message that would not fit typical logging levels? (Info/Debug/Error etc)
- software_writer 3y agoI was trying to think of a good example, but the following table from RFC 5424 [1] might be a good starting point. I guess unknown could be used for the top 3 conditions. Numerical Severity Code 0 Emergency: system is unusable 1 Alert: action must be taken immediately 2 Critical: critical conditions 3 Error: error conditions 4 Warning: warning conditions 5 Notice: normal but significant condition 6 Informational: informational messages 7 Debug: debug-level messages [1] https://datatracker.ietf.org/doc/html/rfc5424 https://datatracker.ietf.org/doc/html/rfc5424
- Nmi2osv7 3y agopossibly the log value was reduced to just a string when it crossed an api boundary or something?
- redgreenshoe 3y agoThe code has noticed a condition that may or may not be meaningful—it is not explicitly handled or classified. The correct place the message noting this ought to go could well be unknown. INFO buries it, which may be very bad. Higher severities might be crying wolf. UNKNOWN starts showing up in the logs, that tells you to go take a closer look, and tells you that nobody has encoded the severity of the message into the system.
- javaunsafe2019 3y agoWow in 2023 someone thinks this is worth a blog post? At least some log scraping + monitors with graylog, ELK or the like would be the minimum imo…
- software_writer 3y ago> Wow in 2023 someone thinks this is worth a blog post? It was meant to be a beginner-level introduction to logging (especially for those developers who got started in 2023 ;))
- javaunsafe2019 3y agoBut you find those things in every basic book or course etc. That are the very basics nowadays. And I would not call scraping and monitoring advanced topics. Advanced topics are multi stage image builds, helm charts + deployments and clean architecture. Just to name a few.
- michaelcampbell 3y agoIf only you weren't forced to read it.
- suction 3y ago[dead]
- revskill 3y agoDirty architecture is more advanced topic i think.
- pdntspa 3y agoIn the ridiculous clockwork that is "modern" software deployment, sure. But what if you're just trying to stand up a rails app on a boring linux droplet?
- kayodelycaon 3y agoEveryone starts somewhere. Log scraping and monitoring is a pretty advanced topic for a new developer.
- hbroadbent 3y agoGreat post! Akshay has been super active in the Ruby / Rails communities on Reddit and he's always supportive. Glad to see one of his posts here on HN. And frankly stunning to see a Ruby post on the front page!
- bluepod4 3y agoThere was a “Metaprogramming in Ruby” article on the front page last week https://news.ycombinator.com/item?id=36875815 https://news.ycombinator.com/item?id=36875815