开发者

require': no such file to load -- active_support/core_ext/logger

When I do rails s or rails c.. it gives me this error. tried removing rails and reinstalling then uninstalled whole of ruby and reinstalled both rails a ruby still the same error. line 7 that is generating the error is require 'logger' ... running this line in irb also generates the same error.. m using ruby1.9.2 and rails 3.0.6

Been looking to resolve this error for hours now... every thing was working fine a couple of days ago and now it seems to break.. may be I added a gem to the Gemfile that broke it..

/usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/core_ext/logger.rb:19:in `require': no such file 开发者_StackOverflow中文版to load -- logger (LoadError)
    from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.6/lib/active_support/core_ext/logger.rb:19:in `<top (required)>'
    from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails.rb:7:in `require'
    from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails.rb:7:in `<top (required)>'
    from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/all.rb:1:in `require'
    from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/all.rb:1:in `<top (required)>'
    from /home/milife/apps/justin/lifemap-webapp/config/application.rb:3:in `require'
    from /home/milife/apps/justin/lifemap-webapp/config/application.rb:3:in `<top (required)>'
    from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/commands.rb:28:in `require'
    from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/commands.rb:28:in `block in <top (required)>'
    from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/commands.rb:27:in `tap'
    from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/commands.rb:27:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>


It's an old question, but if someone like me wanders here wondering how to use ActiveSupport's logger in non-Rails applications, here is how:

# Gemfile
gem 'activesupport'

# your code
require 'active_support/logger`
file_logger = Logger.new('../bot.txt', 'daily')
logger = Logger.new(STDOUT)
logger.extend(ActiveSupport::Logger.broadcast(file_logger))
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜