Rails记录器消息test.log? [英] Rails logger messages test.log?

查看:66
本文介绍了Rails记录器消息test.log?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行单元和功能测试时,是否可以配置rails以显示logger.debug消息(来自控制器内部的logger.debug语句),以显示在test.log内部(或向控制台)?

Is it possible to configure rails to show logger.debug messages (from logger.debug statements inside controllers) to display inside test.log (or to the console) when running unit and functional tests?

我在test_helper.rb中添加了以下内容.我直接在测试内部看到logger.debug语句发出的消息,但在控制器方法内部却没有logger语句发出的消息?

I added the following to test_helper.rb. I see messages from logger.debug statements directly inside tests but no messages from logger statements inside controller methods?

def logger
    RAILS_DEFAULT_LOGGER
end

推荐答案

对我来说很好.您是否已将config.log_level设置为特定的值?

Works fine for me. Have you set your config.log_level to something specific?

无论如何

config.log_level = :debug 

应该工作吗?

这篇关于Rails记录器消息test.log?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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