本文介绍了Rails 3中的config.logger和config.paths.log的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试启动服务器时收到此错误.
I get this error when trying to start the server.
logger.rb:541:in `exist?': can't convert Rails::Paths::Path into String (TypeError)
这是我development.rb中的代码.
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
我尝试添加.to_s,但这没有用.
I have tried adding .to_s, but it's no use.
Google也无济于事.
Google is no help either.
推荐答案
尝试
config.logger = Logger.new(config.paths.log.first.path)
http://api.rubyonrails.org/classes/Rails/Paths/Path.html
这篇关于Rails 3中的config.logger和config.paths.log的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!