Dal
Dal

Reputation: 164

prevent rails logging params to console

I am making a rails app with video uploads. In testing any medium to big sized video totally wrecks my server logs since it tries to print out the video file. It sent the response but 10 minutes later it is still trying to print out the video file. Can I prevent rails from logging the params?

Upvotes: 1

Views: 349

Answers (1)

tadman
tadman

Reputation: 211540

There's a way of suppressing arbitrary parameters in your configuration, so just include the name you want to suppress. For example:

Rails.application.config.filter_parameters += [ :video ]

This is described in the documentation and is by default loaded in config/initializers/filter_parameter_logging.rb. You could either edit that and add your params, or to make it modular, add another initializer file of the same format.

Note this won't block logging of SQL queries, so if you're inserting large BLOB type objects your log will be noisy. This is why it's usually better to dump the video on an object-store like Amazon S3.

Upvotes: 3

Related Questions