Rails logger messages test.log?

2019-04-07 04:06发布

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?

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

2条回答
做个烂人
2楼-- · 2019-04-07 04:24

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

Eitherway,

config.log_level = :debug 

should work?

查看更多
混吃等死
3楼-- · 2019-04-07 04:36

From Rails 3.2 upwards the method in test_helper.rb should look like this:

def logger
    Rails.logger
end
查看更多
登录 后发表回答