简体   繁体   English

Rails:在生产上发表声明

[英]Rails: puts statement on production

In development puts "working" is shown on the console. 在开发中,控制台上显示“工作”结果。 In production this is not shown. 在生产中未显示。 But I need to show it on production as well. 但是我也需要在生产中展示它。

For example: 例如:

def create
 puts "working on production and development"
end

I want to show working on production and development on production log as well. 我也想在生产日志中显示working on production and development How can I do this? 我怎样才能做到这一点?

Try to use logger.info . 尝试使用logger.info puts only work in models etc. In controller you have to use logger.info "This is from info" . 只能在模型等中使用。在控制器中,您必须使用logger.info "This is from info"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM