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

余生颓废 提交于 2019-12-18 16:41:28

问题


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


回答1:


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))


来源:https://stackoverflow.com/questions/22158675/thin-server-ouput-rails-application-logs-to-console-as-rails-s-does

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!