tag:blogger.com,1999:blog-3718956085911858962.post4611619204875057053..comments2023-12-27T14:48:02.113+05:30Comments on Electric Sheep Blog: ActiveResource logging tipAnonymoushttp://www.blogger.com/profile/11938300811286150164noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-3718956085911858962.post-88498005306093203402011-06-29T03:49:05.597+05:302011-06-29T03:49:05.597+05:30where does ActiveResource log to? Or rather, for a...where does ActiveResource log to? Or rather, for a rails application in production mode, where does ActiveRecord.logger write to? (production.log?)<br /><br />I can seem to find ActiveResource calls in the log file even after this change in environment.rb<br /><br />thanksUnknownhttps://www.blogger.com/profile/01275130145590932051noreply@blogger.comtag:blogger.com,1999:blog-3718956085911858962.post-56770252938400329232011-05-05T16:07:05.824+05:302011-05-05T16:07:05.824+05:30I've already patched connection to allow a cus...I've already patched connection to allow a custom header value but I don't see how to get it to log...<br /><br />class ActiveResource::Connection<br /> alias :static_default_header :default_header<br /><br /> def set_header(key, value)<br /> default_header.update(key => value)<br /> end<br />endadamhttps://www.blogger.com/profile/12562233516690666160noreply@blogger.comtag:blogger.com,1999:blog-3718956085911858962.post-74897999898833616082011-05-05T15:35:57.687+05:302011-05-05T15:35:57.687+05:30Yes, but you'd have to monkey patch ActiveReso...Yes, but you'd have to monkey patch <i>ActiveResource#connection</i>.Anonymoushttps://www.blogger.com/profile/11938300811286150164noreply@blogger.comtag:blogger.com,1999:blog-3718956085911858962.post-88095289456438563522011-05-05T15:26:17.888+05:302011-05-05T15:26:17.888+05:30Any way to have the Active Resource loggers also l...Any way to have the Active Resource loggers also log the http headers going out?adamhttps://www.blogger.com/profile/12562233516690666160noreply@blogger.comtag:blogger.com,1999:blog-3718956085911858962.post-32971190349533251442010-05-02T07:22:17.688+05:302010-05-02T07:22:17.688+05:30I have a file that I put in the initializers direc...I have a file that I put in the initializers directory to print the AR queries to STDOUT in script/console. You could do the same with area.<br /><br />The script is:<br /># make AR output go to STDOUT in script/console<br />if "irb" == $0<br /> ActiveRecord::Base.logger = Logger.new(STDOUT)<br />endBarretthttp://blog.websitesbybarrett.comnoreply@blogger.comtag:blogger.com,1999:blog-3718956085911858962.post-85734931210398198312009-12-17T14:30:15.844+05:302009-12-17T14:30:15.844+05:30@DerHeiligste That's probably because inside A...@DerHeiligste That's probably because inside ActiveRecord::Base.loggers was still nil inside of the config block.<br /><br />Feel free to ping me should you need any further assistance - I've spent more time than I care to think about alternately developing POX resources and wrestling with ActiveResource, so hopefully I can save you some effort.Anonymoushttps://www.blogger.com/profile/11938300811286150164noreply@blogger.comtag:blogger.com,1999:blog-3718956085911858962.post-43554773692818004782009-12-17T04:40:58.778+05:302009-12-17T04:40:58.778+05:30Thanks a million!
Tip for totally clueless people...Thanks a million!<br /><br />Tip for totally clueless people like me: it has to be put outside of the "Rails::Initializer.run do |config| ... end" section (at least I got a scary error when I put it in there).<br /><br />I know next to nothing about Ruby and even less about Rails, but I'm trying to design our company's web-service API to be as ActiveResource-friendly as possible. In my book that means I have to develop at least a simple Rails app that exercises all of the API. Combined with my extreme ignorance leads to GSDD (Google-Search Driven Development), which is only possible because of wonderful people like you who put this information where Google can index it.<br /><br />Again, thanks a million times!DerHeiligstehttps://www.blogger.com/profile/07074727197158598993noreply@blogger.comtag:blogger.com,1999:blog-3718956085911858962.post-36578723707417388292009-10-23T23:10:33.840+05:302009-10-23T23:10:33.840+05:30Thank you!! But I had to put this line inside con...Thank you!! But I had to put this line inside config/initializers/new_rails_defaults.rbUnknownhttps://www.blogger.com/profile/02756089702263053660noreply@blogger.comtag:blogger.com,1999:blog-3718956085911858962.post-46224267403148175792009-07-09T23:40:28.254+05:302009-07-09T23:40:28.254+05:30Thanks man...big help. Much appreciated.Thanks man...big help. Much appreciated.Anonymousnoreply@blogger.com