ruby-on-railsthin

Thin server: ouput rails application logs to console, as 'rails s' does


I need to run thin start or thin -ssl ... start within the root of my rails app, and see the application logs output to the console, similar to what rails s does


Solution

  • In config.ru file, located at the root of your application, add the following code, just before the line run Rails.application:

    console = ActiveSupport::Logger.new($stdout)
    console.formatter = Rails.logger.formatter
    console.level = Rails.logger.level
    
    Rails.logger.extend(ActiveSupport::Logger.broadcast(console))