cdmo
cdmo

Reputation: 1309

Change the log location (i.e., `LogDevice`) in a Ruby on Rails (version 6) application

Rails 3 seems to have had a property in config for changing the output location of Rails.logger, config.log_path. That's been deprecated. Looking at a Rails 6 application, is this the way to do that now? Or did this config property get moved to something new?

  logger           = ActiveSupport::Logger.new('log/blahblah.log')
  logger.formatter = config.log_formatter
  config.logger    = ActiveSupport::TaggedLogging.new(logger)

Upvotes: 5

Views: 542

Answers (1)

nuaky
nuaky

Reputation: 2086

This will do the trick:

config.paths['log'] = 'log/new_log_file.log'

You can read more about paths here: https://api.rubyonrails.org/classes/Rails/Application/Configuration.html#method-i-paths

Upvotes: 4

Related Questions