minimize rails logging
I'm aware that Rails has a few different levels for logging, but how can I only log the things I want it to, or rather, I only want things in my log that I specify with logger.debug
Is it possible to create my开发者_如何转开发 own logging level?
Also (last part of my question I swear) it seems that when Rails is in development mode, it ignores my logging level I choose in config/environment/development.rb
The debug log level is the lowest on the importance totem pole. Setting the level to debug means you want all messages. If your purpose is to debug (as apposed to improve production performance), you can opt to post filter from the command line.
tail -f development.log | grep debug
If performance, privacy, security is your goal, you could open up the Logger class and override some methods
class Logger
def warn
#do nothing
end
def info
#do nothing
end
def fatal
#do nothing
end
def error
#do nothing
end
end
The log level in config/enfironment.rb will override all environments (development, production, etc) - this could explain why your development settings are getting ignored.
精彩评论