Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime error on Ruby 2, Rails 4 #11

Open
kreeger opened this issue Mar 5, 2013 · 7 comments
Open

Runtime error on Ruby 2, Rails 4 #11

kreeger opened this issue Mar 5, 2013 · 7 comments

Comments

@kreeger
Copy link

kreeger commented Mar 5, 2013

A bit ahead of the curve, perhaps, but I'm getting an error at runtime when I boot up a Rails 4 (beta1) server; evidently ActiveSupport::BufferedLogger is no more.

/Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/better_logging-1.0.3/lib/better_logging/better_logging.rb:12:in `<module:BetterLogging>': uninitialized constant ActiveSupport::BufferedLogger (NameError)
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/better_logging-1.0.3/lib/better_logging/better_logging.rb:10:in `<module:RailsPlugins>'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/better_logging-1.0.3/lib/better_logging/better_logging.rb:9:in `<module:PaulDowman>'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/better_logging-1.0.3/lib/better_logging/better_logging.rb:8:in `<top (required)>'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/better_logging-1.0.3/lib/better_logging.rb:2:in `require'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/better_logging-1.0.3/lib/better_logging.rb:2:in `<top (required)>'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/runtime.rb:72:in `require'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/runtime.rb:70:in `each'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/runtime.rb:70:in `block in require'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/runtime.rb:59:in `each'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/runtime.rb:59:in `require'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler.rb:132:in `require'
    from /Users/bkreeger/Code/universal-uclick/support/otterloop/config/application.rb:10:in `<top (required)>'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/railties-4.0.0.beta1/lib/rails/commands.rb:76:in `require'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/railties-4.0.0.beta1/lib/rails/commands.rb:76:in `block in <top (required)>'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/railties-4.0.0.beta1/lib/rails/commands.rb:73:in `tap'
    from /Users/bkreeger/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/railties-4.0.0.beta1/lib/rails/commands.rb:73:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

If/when I have time, I may submit a pull request to see if I can fix this, unless someone else beats me to it.

@pauldowman
Copy link
Owner

Thanks for pointing it out! A pull request would be awesome, otherwise I'll try to get to it when I can but I haven't had much time to play with Rails 4 yet.

@snow
Copy link

snow commented Mar 19, 2013

http://edgeguides.rubyonrails.org/4_0_release_notes.html#active-support-deprecations

BufferedLogger is deprecated. Use ActiveSupport::Logger, or the logger from Ruby stdlib.

I simply replaced all ActiveSupport::BufferedLogger with ActiveSupport::Logger. Because I haven't had time to do the "if..else.." work yet. This solution results in a version that may break rails 3.x. So I simply use

gem 'better_logging', github: 'snow/better_logging'

in rails4 projects and origin gem in rails3 projects.

And this folk is only intend for temporary use till the origin gem release a version that supports rails 4.

sorry for my broken Englisth.

@pauldowman
Copy link
Owner

Thanks, I'll try to find the time to do it in a conditional way.

@snow
Copy link

snow commented Mar 27, 2013

and, in lib/better_logging/better_logging.rb, ln 32, should use Rails::VERSION::MAJOR instead of Rails.version.to_i, because Rails.version maybe '4.0.0.beta1'

snow@ac2a741

@pauldowman
Copy link
Owner

Thanks!

Update for Rails 4 coming as soon as I have time.

dennisquintel added a commit to quintel/etmodel that referenced this issue Dec 2, 2013
dennisquintel added a commit to quintel/etmodel that referenced this issue Dec 9, 2013
dennisquintel added a commit to quintel/etmodel that referenced this issue Dec 19, 2013
@monomadic
Copy link

Actually, when I switch to this other fork (on rails 4), the output is now empty, like this:

=> Booting Thin
=> Rails 4.1.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop
DEBUG
DEBUG
INFO
INFO
INFO
DEBUG
DEBUG
INFO
INFO
INFO
INFO

@pauldowman
Copy link
Owner

Sorry, I'm not maintaining (or even using) this any more, but check @foodforarabbit's fork:

https://github.com/foodforarabbit/better_logging/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants