I have been looking for a way to eliminate the contents of certain
large (e.g. pdf files) database columns from my development (and
production) logs using RoR 3 with no luck. I found many posts, etc.
about eliminating parameters (e.g. password) from the log, but nothing
about the contents of the db.
I have two reasons for this, 1) the verbosity and size of the log slow
down my development/debugging, and 2) writing these columns definitely
slows the operation of the site itself.
I have been looking for a way to eliminate the contents of certain
large (e.g. pdf files) database columns from my development (and
production) logs using RoR 3 with no luck.
Wait, you're storing PDF files in your DB? Stop doing that. Data like
that belongs in the filesystem.
I have config.filter_parameters = [:password, :document_file] in
application.rb. :document_file is the name of the big column. I
“puts” the array.inspect and confirmed that both password and
document_file are there. The contents of the big column are still
showing up in the log.
BTW, I was advised to store these data in the file system instead of
the db, Unfortunately, the file system will be read-only once I
deploy and I want to test in the environment that I will be using,
so I set the rails tree to read only during some of my development
and test operations (which is how I discovered that I needed to use
the database for all dynamic data in the first place).
I have been looking for a way to eliminate the contents of
certain
large (e.g. pdf files) database columns from my development
(and
production) logs using RoR 3 with no luck. I found many posts,
etc.
about eliminating parameters (e.g. password) from the log, but
nothing
about the contents of the db.
I have two reasons for this, 1) the verbosity and size of the
log slow
down my development/debugging, and 2) writing these columns
definitely
slows the operation of the site itself.
Can anyone help?
You want it removed from the “SQL (1.2ms) INSERT…” line in the logs? filter_params will remove it from the “Parameters: {…” line.
I think you’re only option for removing it from the SQL in the log itself is to silence the active record logger whenever you do something that generates those queries.
It’s not an issue in production as production doesn’t log the sql queries…
After a long interlude, I found my problem with
config.filter_parameters. I can't count how many hours I have wasted
due to a typo The original line was: