- We have a lot of logging-gems. log4r, logging, lograge, log4r-gelf, graylog2_exceptions. I thought that I'd moved things from logging -> log4r, but it turns out that some of the logging was still going through the logging gem, meaning my configuration was imperfect.
- Additionally, virtually every gem requires some compatible configuration
- The mechanism we were using to inject tracing data was forcing all logging traffic to be sent at the same 'level' (INFO)
- Passing loggers in was a haphazard business of basically passing Procs around, if we wanted to get tracing added. It wasn't very flexible.
I'd like to roll back to the logging gem, which I now realize has the same configuration options as log4r under the hood. I'd prefer it over log4r because:
- It already comes w/ rails, so it's one less thing to try and unwire
- It's achieved feature parity w/ log4r
- I read 1 message that seemed to indicate that it was under more active development, though the git commit logs on the 2 gems don't seem to indicate much one way or the other.
No one seemed to like the lograge model, and it was its more poorly specified mechanisms for output formatting that forced us into the 'configure and trace via proc' concept in the first place. I think it should be possible to achieve the same goals w/ custom layout classes, but even if we can't, I'd still vote to remove it simply because of the monkey wrench it's thrown into the mix.
Wrap the logger class to add tracing details to the log messages, instead of overriding a formatter. In addition to being a cleaner implementation (adding data in a method that was designed to just format data was always distasteful, and meant that it was harder to get the extra data in non-gelf end-points. Wrapping the logger, and overriding the logging methods themselves provides the appropriate point at which to add the additional logging information orthogonally.
Additionally, wrapping the logger class that remains otherwise faithful to the signature of the rails standard logger makes it easier to configure other gems (graylog_exceptions, or configuring loggers in busibee, cloudstack, etc), because you just create a logger, and hand it off.
I know it's PoC, but what's the motivation for prepending over inheritance?