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.

Rails.logger の出力先を確認する

Posted at

logger がどこのファイルに出力しているかを確認

Rails.logger.instance_variable_get(:@logdev).instance_variable_get(:@dev)

Loggerが持っているインスタンス変数を参照すればとりあえずはわかる。

[1] pry(main)> Rails.logger
=> #<ActiveSupport::Logger:0x0000559ee3bd8238
 @default_formatter=#<Logger::Formatter:0x0000559ee3bd8170 @datetime_format=nil>,
 @formatter=#<ActiveSupport::Logger::SimpleFormatter:0x0000559ee06c9178 @datetime_format=nil>,
 @level=0,
 @local_levels=#<Concurrent::Map:0x0000559ee3bd8030 entries=0 default_proc=nil>,
 @logdev=
  #<Logger::LogDevice:0x0000559ee3bd8120
   @dev=#<File:/home/vagrant/ultra-man/spacium/log/development.log>,
   @filename=nil,
   @mon_count=0,
   @mon_mutex=#<Thread::Mutex:0x0000559ee3bd80d0>,
   @mon_mutex_owner_object_id=47070457020560,
   @mon_owner=nil,
   @shift_age=nil,
   @shift_period_suffix=nil,
   @shift_size=nil>,
 @progname=nil>

rails console だとよく分かる。

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?