Rails Logger appears to be duplicating log lines

后端 未结 2 1295
情深已故
情深已故 2021-02-19 00:52

I am experiencing something curious with the rails logger.

When I insert a Rails.logger.info(\"Some text\") in the code, usually to trace flow, I am getting two lines of

2条回答
  •  萌比男神i
    2021-02-19 01:17

    This small workaround solved my issue. Follow these steps:

    Under Rails External Libraries, Search for railties module. Go to this path: /lib/commands/server.rb

    In this file comment this line, Rails.logger.extend(ActiveSupport::Logger.broadcast(console))

    This command will switch off broadcasting, and just restart your rails server. You will not see any repeated logs anymore. Happy coding.

    For more info checkout this issue page of rails: https://github.com/heroku/rails_stdout_logging/issues/1

提交回复
热议问题