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

NoMethodError: undefined method `flush' for Logger #1

Open
ilyadoroshin opened this issue Aug 4, 2015 · 3 comments
Open

NoMethodError: undefined method `flush' for Logger #1

ilyadoroshin opened this issue Aug 4, 2015 · 3 comments

Comments

@ilyadoroshin
Copy link

Hello, guys!

First of all, wanted to say thanks for that gem, works great! But I've found an issue:
React::Rails::HotLoader.log: No flush method for Rails.logger in edge rails

For some reason, you decided to render all errors through your own method, which ends up running ::Rails.logger.flush, that is not available (at least in rails 4.1.6)

@ilyadoroshin
Copy link
Author

FYI, this helped me to fix my problem.

// config/initializers/react_rails_hot_loader.rb
if Rails.env.development?
  React::Rails::HotLoader.class_eval do
    def self.log(message)
      msg = "[HotLoader] #{message}"
      ::Rails.logger.info(msg)
      ::Rails.logger.try(:flush)
    end
  end

  React::Rails::HotLoader.start()
end

@rmosolgo
Copy link
Owner

rmosolgo commented Aug 4, 2015

Thanks for the heads up!

Yeah, I used my own logger so I could modify all messages in one place, turn them off and on, etc.

Thanks for sharing your fix, I'll take a look at the changes in edge Rails and see what's a good long term solution

@ilyadoroshin
Copy link
Author

@rmosolgo 👍

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

2 participants