DarkFox
DarkFox

Reputation: 55

config.logger and config.paths.log in Rails 3

I get this error when trying to start the server.

logger.rb:541:in `exist?': can't convert Rails::Paths::Path into String (TypeError)

This is the code in my development.rb.

require 'log_formatter'
config.logger = Logger.new(config.paths.log.first)
config.logger.formatter = LogFormatter.new
config.logger.level = Logger::DEBUG

I have tried adding .to_s, but it's no use.

Google is no help either.

Upvotes: 1

Views: 6546

Answers (2)

Andy
Andy

Reputation: 1831

In Rails 3.1.1 the old syntax has been deprecated. You should now use:

config.paths['log'].first

Upvotes: 10

Jeremy
Jeremy

Reputation: 22415

Try

config.logger = Logger.new(config.paths.log.first.path)

http://api.rubyonrails.org/classes/Rails/Paths/Path.html

Upvotes: 2

Related Questions