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 1 year has passed since last update.

【Rails】好きなログファイルを作って出力

Posted at

環境

  • Ruby 2.7.6
  • Rails 5.2.8

コード

@log = Logger.new('log/check_site.log')

msg = "AAAAAAAAAAAAA"

@log.info(msg)

まとめ

設定ファイル触るとかありますけど、その場その場でちょっと違うログファイルに出力したかったりするので、この方法が良いと思います。

カンタン便利。

ログレベルをdebugやらinfoやらあるのは、他記事を参考にして下さい。

これとか↓
https://qiita.com/sobameshi0901/items/b963e7046e2ae8b8e813

終わり

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?