开发者

What caused the rails application crash?

I'm sure someone can explain this.

we have an application that has been in production for an year. recently we saw an increase in number of support requests for people having difficulty signing into the system. after scratching our head because we couldn't recreate the problem in development, we decided we'll switch on debug logger in production for a month. that was june 5th.

application worked fine with the above change and we were waiting.

then yesterday we noticed that the log files were getting huge so we made another change in production

config.logger = Logger.new("#{RAILS_ROOT}/log/production.log", 50, 1048576)

after this change, the application started crashing while processing a particular file. this particular line of code was

RAILS_DEFAULT_LOGGER.info "Payment Information Request: ", request.inspect

as you can see there was a comma instead of a plus sign. this piece of code was introduced in Mar.

the question is this: why did the application fail now? if changing the debug level caused the application to process this line of code it should have started failing on june 5th! why today. p开发者_Go百科lease someone help us. Are we missing the obvious here? if you dont have an answer, at least let us know we aren't the only one that are bonkers.


When you created a new logger, it was a different class than the original.

By default, Rails uses a ActiveSupport::BufferedLogger, which will take the second argument with no exception. I believe the second argument is used as the program name. request.inspect returns a string, so it just used it as a very large name.

The new logger is just a standard Logger in Ruby core, which will raise an exception when the wrong number of arguments are passed to it.


Should it not be

RAILS_DEFAULT_LOGGER.info "Payment Information Request: #{request.inspect}"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜