问题
In development
environment, rails logger logs all ActionCable events which is sometimes annoying (for my project, every now and then it's transmitting messages and log tail is running like wild horse). What is an efficient way to suppress all event logs from ActionCable? Also, how can I suppress some specific ActionCable events?
回答1:
To completely disable logging from ActionCable you should configure ActionCable to use logger that do nothing
ActionCable.server.config.logger = Logger.new(nil)
回答2:
Same here, finally I found a solution. You should override a code in /app/channels/application_cable/channel.rb as follows
module ApplicationCable
class Channel < ActionCable::Channel::Base
def dispatch_action(action, data)
#logger.info action_signature(action, data)
if method(action).arity == 1
public_send action, data
else
public_send action
end
end
end
end
You can simulate the original behavior by uncommenting out #logger.info action_signature(action, data)
line.
Thanks.
来源:https://stackoverflow.com/questions/38366040/disable-rails-log-for-actioncable-events