Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ruby on rails log file to big -> remove params from it

i made a distribuited real-time system in RoR, it's compose by 2 machine.

PC A: take images from a Camera and send these to the second PC. So this machine send every second an http request with the image in the params. PC B - the server: save the image in a database.

My problem is that the log file become too big because log even the params string. How can i set the logger to truncate the params? or simply remove it?

sorry for my bad english..... i hope that someone can help me. Bye Davide Lentini.

like image 331
Dabidi Avatar asked Mar 29 '12 14:03

Dabidi


2 Answers

To specifically remove certain params from the logs you can set the config.filter_parameters in application.rb like this:

config.filter_parameters += [:parameter_name]

This will replace the value of the filtered parameter with "[FILTERED]".

like image 105
CMW Avatar answered Sep 25 '22 17:09

CMW


You can set the log level to be less verbose.

See the rails guide on debugging.

So for your entire application (in development), add this to config/environments/development.rb:

config.log_level = :warn # In any environment initializer, or

Or, to change the logging level directly in your application:

Rails.logger.level = 0 # at any time
like image 29
ipd Avatar answered Sep 26 '22 17:09

ipd