By default, Rails writes both STDOUT and STDERR streams to “<environment>.log” file. Fox example, in production, the file production.log has the request log as well as any application errors. But it is helpful, if you can send the errors to a separate file, that you can watch for errors.
Though there are gems to do this, the easiest way is to use the broadcast method available in Rails logger. Create a file with the following content and place it in ‘initializers’ directory.
if Rails.env == 'production'
error = ActiveSupport::Logger.new('/var/log/production.error.log')
error.level = Logger::ERROR
That should set it up.