How to see logs for a Rails app

Hello! I am running a Rails app on Aptible and am new to using containers. I’d like to be able to see all of the logs from my Rails app when I do ‘aptible logs’. It looks like I’m only getting things at the warning and error level, but would like to see debug and info as well so that I can debug a problem. I have this in my staging.rb file

logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
config.log_level = :debug

Also, I am using puma. Any help is appreciated!

Katie

Hi Katie!

I don’t see anything wrong with your configuration and the default log level is :debug so even without setting it you should get all logs unless the setting is being ignored or overridden somewhere. I see a few potential explanations:

  1. The configuration is correct but the application is only generating error and warning logs. If you believe this might be the case you can add some debugging statements on server startup and see if they appear when the App is restarted with aptible restart.

  2. The configuration is being overridden or ignored. You could try running a rails console locally or in an aptible sshsession and see what Rails.logger.level is set to.

  3. The App is not using the staging configuration. You can check the App’s Configuration with aptible config and debug in a running container using aptible ssh.