LoginSignup
35
36

More than 5 years have passed since last update.

Herokuでアプリケーションのログを出力する

Last updated at Posted at 2014-09-24

たぶん常識な気もするのですが、Rails4アプリをHerokuにデプロイしていて、エラーが発生しているんだけど、heroku logsにエラーがでてこなくて「あれっ」と思ったのでメモしておきます。

Herokuではlogplexを使ってログを出力しているので、アプリ側でproduction環境でのログ出力を標準出力にする必要があります。

このログの対応とそれ以外にもいろいろと面倒を見てくれるので、rails_12factorというGemを追加しました。

Gemfileに下記を追加します。

Gemfile
gem 'rails_12factor', group: :production

ローカル環境でbundle installして、コミットしてHerokuにデプロイします。

gemを追加してherokuへデプロイ
$ bundle install
$ commit -am"Add gem"
$ git push heroku master

[参考]
https://devcenter.heroku.com/articles/rails4

35
36
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
35
36