瘦服务器:将 rails 应用程序日志输出到控制台,就像“rails s"一样 [英] Thin server: ouput rails application logs to console, as 'rails s' does

查看:36
本文介绍了瘦服务器:将 rails 应用程序日志输出到控制台,就像“rails s"一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的 rails 应用程序的根目录中运行 thin startthin -ssl ... start,并查看应用程序日志输出到控制台,类似rails s 的作用

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

推荐答案

在位于应用程序根目录的 config.ru 文件中,在 行之前添加以下代码运行 Rails.application:

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

这篇关于瘦服务器:将 rails 应用程序日志输出到控制台,就像“rails s"一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆