0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

logger.debugの使い方

Last updated at Posted at 2021-10-01

##環境
Rails 6.1.3.2
ruby 2.7.1

##使い方

  1. Controllerなどオブジェクトの中身を見たい箇所に下記を書く
    (1行目と3行目はログを出力したときの見やすさのために書いた)
    配列やハッシュを扱うときはinspectメソッドを使うとより中身が見やすい
logger.debug '-------------------'
logger.debug (中身を見たいオブジェクト).inspect
logger.debug '-------------------'
  1. ターミナルなどで下記コマンドを叩く
$ tail -f log/development.log

##参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?