What levels of logging are available for Heroku?

2019-06-25 23:45发布

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?

2条回答
你好瞎i
2楼-- · 2019-06-26 00:12

Logging on Heroku is just a stream of text lines. So you can log anything you want. You can also filter through that stream, use add-ons for enhanced search, and get a syslog drain of your logs.

查看更多
Emotional °昔
3楼-- · 2019-06-26 00:14

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

$ heroku config:set LOG_LEVEL=DEBUG

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

config.log_level = :debug

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

See the rails-stdout-logging gem

查看更多
登录 后发表回答