I’m currently trying to debug some slow queries that are only happening in environments which run in production mode. I noticed that the log level appears to be hardcoded in production mode (code reference) with no way to directly configure it. I’d like to change this log level to debug (at least temporarily) so I can see more information; is there a way to accomplish this?
I tried some pretty hacky workarounds which involved changing the log level during runtime with the Rails console, but none of the hacks resulted in DB queries showing up in the debug logs (if I manually did debug logs with Rails.logger.debug in the Rails console those did show up after the hacks, though).
Thanks!
P.S. Just to soothe any potential worries about my comment above about issues that only happen in production environments, I’m using Discourse in a quite non-standard way that involves a large number of categories; the issues I’m facing probably aren’t faced by any other Discourse instances.
In production mode it aggregates similar errors by fingerprinting backtraces listening for warnings/errors and fatal messages. The intention is to display a list of open application problems that can somehow be resolved.
In development mode it provides a full fire-hose of all logs produced by Rails. (debug and up). This has significant advantages over console as you have proper access to backtraces for every log line.