This is a very odd problem, it’s been happening, I think, ever since I
patched to Rails 2.1.0
Every time a public method gets called in my Controller, the index
method gets called immediately afterwards. It’s not in my code, and my
best guess after testing it on two pretty different machines is, it’s
not my browser settings either. My cookies and sessions seem to be
working fine, DB isn’t behaving oddly.
In absence of a direct answer, I’m wondering if someone can tell me
how to get Rails Logger (or equivalent) to spit out a complete
stacktrace. I’m sure if I could just see where the heck that call is
coming from, I could solve the rest of it.
This is a very odd problem, it’s been happening, I think, ever since I
patched to Rails 2.1.0
In absence of a direct answer, I’m wondering if someone can tell me
how to get Rails Logger (or equivalent) to spit out a complete
stacktrace. I’m sure if I could just see where the heck that call is
coming from, I could solve the rest of it.
Thanks very much,
Bret
You should find your logs at /log in your rails app folder. There should
be 3 files, one for each environment mode (test / dev / prod), they are
automatically filled up with request information.
Ah, well I solved my problem. The method I needed is
Kernel.caller(start=1)… returns a series of strings roughly
approximating a stacktrace starting with the scope in which caller is
called.
Every controller in rails has a logger automatically instanciated for
them.
Simply use the logger.info(“information to log”), (or .debug, .warn, etc
…) like you used to in other language to log more information. It’s a
lowercase “l”
Since we are in logging, try to call the method .inspect on any object
you wish to look at, that will produce a nice string with your object
information, very handy when it comes to logging
I don’t know much in logging with rails, but so far, that was more than
enough
Guillaume Petit
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.