025 RR Logging – I Do Not Think It Means What You Think It Means
Podcast: Play in new window
| Download (20.8MB)
- Avdi Grimm
- Charles Max Wood
- James Edward Gray
- Tim Pease
Discussed in this Episode
- Any message of note generated by your application
- A message of note is something the conveys meaning or has importance to the developer
- “puts” debugging
- Scroll blindness
- log levels
- log appenders
- Each object can have its own logger
- Set interesting classes to debug and everything else to info or warn
- Global loggers
- Do the simplest thing you need until it no longer works for you
- Set up rolling file appenders
- Ruby’s core Logger class
- shared file locks
- exclusive file locks
- rotation notation by number or by date
- copy then truncate when rotating logs – maintains the file reference
- signal to change log level to debug
- Only send FATAL messages when I’m about to kill the program
- An ERROR is “something bad has happened, but I can work around it”
- WARN – “this problem occurred”
- INFO – “the program is still running. I’m doing this and this and this.”
- DEBUG – “information on where things might be going wrong.”
- You should be between every other line being a log message and having no logging
- We like seeing the SQL in the Rails logs.
- Track interactions and requests to other services
- Log formatting
- Never create your date stamp format. EVER. EVER!
- ISO8601 Datestamp format standard
- Format messages for the consumer. Pretty printed for users. JSON for software.
- Newlines in log messages?
- Log context (to keep track of where you are in the application)
- Include the process id (PID) in forked applications
- How do you group messages related to the same request?
- How do you deal with logs from different applications in different formats?
- Where should I log to? A flat file? database? Twitter?