rails/rails — pull request #7708 by bdurand (2012-09-19 23:33:07+00:00)
Title: Optimize log subscribers to check if the log level is sufficient

This change adds checks to the beginning of logging methods in the default log subscribers to ensure that the log level is sufficient before continuing. Without this code, production applications with logging turned down will still execute a fair bit of code on every request to set up log messages that are then thrown away.

Also made a very minor optimization to time formatting to use string interpolation instead of formatters.

Finally removed Explain queries from being logged by active record since they are not interesting for debugging purposes and only pollute the log. This can clean up development logs significantly when using a variety of third-party gems that force Explain to be run on every query.