dynamically filter params values for logging
to capture some errors I would like to through the query strin开发者_StackOverflow中文版g parameters into a log file to help diagnose.
$mylog.info "bad information " + parms.to_json.to_s
However sometimes there is sensitive information, such as a password. I know there is 'filter_parameter_logging' that can be set however doing something like this doesn't work.
params['filter_parameter_logging'] = :password
How would I go about dynamically masking some of the values?
Try adding the following to your class Application
config.filter_parameters += [:password]
精彩评论