Hide server logs for send_file method

Viewed 61

Rails version: 4.2.0

Ruby version: 2.3.8

Is there any way in a Rails application to hide the absolute path displayed for the send_file method?

controller code:

def download_file(file_path)
  send_file file_path, :x_sendfile => true, :type => 'application/pdf'
end

the path displayed in server logs:

Sent file /home/new_user/Project/new_project/pdfs/plan_7.pdf
1 Answers

Check the config/production.rb and change log level.

Try something like that:

  config.log_level = :fatal

The level can be: :debug, :info, :warn, :error, :fatal, and :unknown. Choise the best option for your case.

Related