The HTTP Request IDs makes it easy to trace requests from end-to-end in the stack and to identify individual requests in mixed logs like Syslog.
Rails 3.2 introduced the ActionDispatch::RequestId middleware that make a unique X-Request-Id header avariable to the response.
curl -I http://sample.dev/
HTTP/1.1 200 OK
Date: Fri, 04 Jul 2014 03:23:43 GMT
To show this request ID in with your application logs, add this line to your config/environments/production.rb
The logs will then be tagged with the Request ID:
I,[2014-07-04T11:23:43.752028#33305] INFO -- : [ddaa28e2-3395-4e66-9ca7-48480882a1df] Started HEAD "/" for 127.0.0.1 at 2014-07-04 11:23:43 +0800I,[2014-07-04T11:23:43.755366#33305] INFO -- : [ddaa28e2-3395-4e66-9ca7-48480882a1df] Processing by StaticPagesController#home as */*I,[2014-07-04T11:23:43.759832#33305] INFO -- : [ddaa28e2-3395-4e66-9ca7-48480882a1df] Rendered static_pages/home.html.erb within layouts/application (0.2ms)I,[2014-07-04T11:23:43.791258#33305] INFO -- : [ddaa28e2-3395-4e66-9ca7-48480882a1df] Rendered layouts/_shim.html.erb (0.0ms)I,[2014-07-04T11:23:43.793947#33305] INFO -- : [ddaa28e2-3395-4e66-9ca7-48480882a1df] Rendered layouts/_header.html.erb (0.3ms)I,[2014-07-04T11:23:43.796489#33305] INFO -- : [ddaa28e2-3395-4e66-9ca7-48480882a1df] Rendered layouts/_footer.html.erb (0.2ms)I,[2014-07-04T11:23:43.797112#33305] INFO -- : [ddaa28e2-3395-4e66-9ca7-48480882a1df] Completed 200 OK in 42ms (Views: 41.2ms | ActiveRecord: 0.0ms)
Last week, We involve a function for users to exports their orders into a spreadsheet document.
We using the spreadsheet gem to modify an existing template spreadsheet.
But when opening the modified spreadsheets by Microsoft Excel, it issues an error:
File error: data may have been lost
After some google search, I was answered to set the encoding explictly:
But it doesn’t works, WTF!
Finally, I decide to create a new spreadsheet and set cell format by hand instead of modify the existing template spreadsheet document.
It’s a painful task. The spreadsheet comes up just fine without error.
Even though it doesn’t elegant, we can get ride of that annoying error.
Yestoday, I upgraded my VirtualBox from version ‘4.2.18’ to ‘4.3.6
along with upgraded the vagrant to '1.4.3’.
After I run vagrant up I got a warning message:
[default] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
prevent things such as shared folders from working properly. If you see
shared folder errors, please make sure the guest additions within the
virtual machine match the version of VirtualBox you have installed on
your host and reload your VM.
Guest Additions Version: 4.2.18
VirtualBox Version: 4.3
After a google, I found that there is a plugin which can automatically
installs the host’s VirtualBox Gest Additions on the gest system.
The reason that the URI returns a 301 redirection is the trailing
slashes are misused. Historically, it’s common for URLs with a
trailing slash to indicate a directory, and those without a trailing
slash to denote a file: