Rails 3 有一个很好的功能,config/application.rb
它允许过滤敏感信息,例如密码,以免出现在日志中,如下所示:
config.filter_parameters += [:password, :creditcardnum]
但是,我的问题在于如何从其他地方的日志中过滤相同的信息。例如,我正在使用 DelayedJob,即使我的密码是从我的开发日志中过滤出来的,它仍然会在 DelayedJob 日志中出现(我想类似的事情也会发生在类似工作的 gems 中):
SQL (14.3ms) INSERT INTO "delayed_jobs" ("attempts", "created_at", "failed_at", "handler", "last_error", "locked_at", "locked_by", "priority", "queue", "run_at", "updated_at") VALUES (blah blah blah...) username: MYUSERNAME@EMAIL.COM\n password: MYPASSWORDHERE\n method_name: :destroy\nargs: []\n"], ["last_error", nil], ["locked_at", nil], ["locked_by", nil], ["priority", 0], ["queue", nil], ["run_at", Wed, 03 Jul 2013 03:07:02 UTC +00:00], ["updated_at", Wed, 03 Jul 2013 03:07:02 UTC +00:00]]
你对此有什么想法吗?