Alter log level in production?

Hey there!

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. :slight_smile:

1 Like