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.

【Ruby】Loggerライブラリを使用して一定期間ごとにログファイルを記録したい

Last updated at Posted at 2022-10-02

概要

一定の期間ごとにログファイルをローテートする場合には、
引数でローテートする期間を指定する。
常にログを確認する場合一つのログファイルに書き込まれると確認が大変なため期間でログを管理すると良いと感じた。

require 'logger'
logger = Logger.new('foo.log', 'daily') #日ごとのログ
logger = Logger.new('foo.log', 'weekly') #週ごとのログ
logger = Logger.new('foo.log', 'monthly') #月ごとのログ

参考

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?