Is there anyway to tell ruby to log the url it got as a request in the log?
I am seeing some crashing in my app and can’t pin down what url that is doing it.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, it’s absolutely possible, but how you implement it will depend on your app. If you’re using a framework like Rails or Rack use their built-in logging classes (Thin hooks into Rack’s logging class automatically). If it’s a vanilla Ruby script then you can include Thin::Logging in your class, which will give you
log,trace,debug, andlog_errormethods.As for logging the requested URL specifically, that depends entirely on your implementation.