debug variable value cakephp

glasspill picture glasspill · May 18, 2012 · Viewed 18.7k times · Source

How can I print out some debug output, like the contents of an array variable? I'm using cakephp and eclipse and can't seem to be able to do this. I am not talking about logging errors, just print some variable value. It might be obvious and really easy to do, but I can't find a way to do it.

Thank you

Answer

Justin T. picture Justin T. · May 18, 2012

There are no dumb questions for someone learning. So here are your options :

  • Anywhere in your code, place the following statement debug($var);. This works in Controllers/Views and Models as well.

  • Alternative: use CakeLog::write(LOG_DEBUG, "..."); to log debug values

  • To be complete, one should install the very helpful DebugKit plugin. Get it from here