开发者

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

开发者 https://www.devze.com 2023-01-27 06:44 出处:网络
I get this error when trying to start the server. logger.rb:541:in `exist?\': can\'t conve开发者_高级运维rt Rails::Paths::Path into String (TypeError)

I get this error when trying to start the server.

logger.rb:541:in `exist?': can't conve开发者_高级运维rt 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.


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

config.paths['log'].first


Try

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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消