Heroku可以使用什么级别的日志记录? [英] What levels of logging are available for Heroku?

查看:87
本文介绍了Heroku可以使用什么级别的日志记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Heroku上运行的Rails应用程序,它运行良好.我让它与调试级别的日志记录一起运行,但是现在我切换回了INFO.还有哪些其他级别的调试可用?在生产环境中运行时,应该使用什么级别的日志记录?

I have a Rails app running on Heroku, it runs fine. I had it running with debug level logging, but now I switched back to INFO. What other levels of debugging are available? And when running for production, what level of logging should I use?

推荐答案

在Heroku上,您可以使用LOG_LEVEL环境变量来设置日志级别

On Heroku you can set your log level by using the LOG_LEVEL environment variable

$ heroku config:set LOG_LEVEL=DEBUG

有效值包括DEBUG,INFO,WARN,ERROR和FATAL.另外,您可以在环境配置中设置此值:

Valid values include DEBUG, INFO, WARN, ERROR, and FATAL. Alternatively you can set this value in your environment config:

config.log_level = :debug

如果两者都设置,则LOG_LEVEL将优先.您很可能需要在生产中使用INFO.

If both are set LOG_LEVEL will take precedence. You'll most likely want INFO in production.

查看rails-stdout-logging宝石

这篇关于Heroku可以使用什么级别的日志记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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