Logging-on-Rails 5: hide and seek with formatting, readibility and parsing

Alain Seng
12 min readNov 1, 2018
Photography skill \o/

Currently under Rails 5.2.1 / Ruby 2.5.1 and I quickly had enough of System.out.prin… oops, enough of puts. Anyway. I just want to track what happens in my application: how many milliseconds is taken by this method? Was this called before that? What happened before this error? And such.

To get the info, logging is our messiah. Hallelujah…or not.

As starters, here are some global Rails-independent concepts related to logging:

Summary

  1. Ruby default logger
    1.1 Default configuration is verbose and overwhelming
    1.2 Fine tuning configuration
    1.3 Summary 1
    1.4 Going further: custom log formatting
    1.5 Custom console formatting
    1.6 Summary 2
  2. Log4r
  3. Logging
    3.1 Summary
  4. Lograge
    4.1 Simple configuration with

--

--

Alain Seng

🇫🇷Front-end dev turned Engineering Manager based in JP🇯🇵 | Writing about web dev & anything that could make one's life easier