简体   繁体   English

将Rails信息级别的日志语句打印到stdout

[英]Print Rails info-level log statements to stdout

I have rake tasks which call logger.info. 我有一些叫logger.info的耙子任务。 In development, I'd like to see these messages on stdout as well. 在开发中,我也希望在stdout上看到这些消息。 Is this possible without using my own log method which also calls puts? 如果不使用我自己的也调用puts的log方法,是否有可能?

Specify in thine development environment file config/environments/development.rb of thine application the following code line: 在您的应用程序的开发环境文件config / environments / development.rb中指定以下代码行:

config.log_level = :info

There are :debug , :info , :warn , :error , :fatal , and :unknown log level that are consequently represent numbers of 0 to 5. Thou canst specify any of the level for the config variable. :debug:info:warn:error:fatal:unknown日志级别,因此它们表示0到5的数字。您可以为config变量指定任何级别。

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

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