LoginSignup
2
2

More than 5 years have passed since last update.

Railsの開発環境ですべてのログを出力して、時刻も出す

Last updated at Posted at 2016-07-05

対応方法

environments/development.rbに設定を追加

 config.log_level = :debug
 config.log_formatter = Logger::Formatter.new

説明

ログレベルは以下の順で決まってる、一番低いレベルのdebugに設定すれば、すべてのログが出力される

fatal  # プログラムがクラッシュしたなどエラーハンドリングできないエラー
error  # エラーハンドリングできるエラー
warn   # 警告
info   # システム操作に対する一般的な役に立つ情報
debug  # 開発者向けの詳細な情報 

開発環境でproduction環境と同じように時刻出すにはlog_formatterを設定すれば良い

 config.log_formatter = Logger::Formatter.new
2
2
0

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
2
2