Rails not logging requests

I’m utterly stumped as to why I’m not able to see the Rails controller outputs in my development log. I’ve spent days beating my head against a wall trying to figure this out and I’m not sure what else to try.

Setup: Rails 5.2.3 app running ruby 2.6.3 via docker-compose.

It started with me not being able to see my app logs when running docker logs <container-name>. However, I soon realized that I was able to see the output from puma starting and a shell script that ran rake tasks that the issue might be with rails.

To help assist with finding the issue:

  • Tore down and rebuilt the docker environment, several times
  • Stopped writing via STDOUT in favor of logs/development.log
  • Disabled lograge and elastic-apm, just in case
  • Reverted my development.rb config back to what’s generated with a rails new
  • Followed the suggestions here

However, when running the rails console via docker exec -it <container-name>:

  • Running Rails.logger.level returns 2 which is warn, despite the default logging level being dev
  • I’m able to see log output when running Rails.logger.warn 'foo'
  • After setting Rails.logger.level = 0 I’m able to see output when running Rails.logger.debug 'foo'

I tried setting the value explicitly as config.log_level = :debug in development.rb yet it still set itself to the warn level.

However, I’m still not able to see any logs when navigating the application. Any thoughts?

Source: StackOverflow