On debugging

As we put more and more into programs, debugging becomes time consuming. This quote is particularly true:

As soon as we started programming, we found to our surprise that it wasn’t as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.

— Sir Maurice Wilkes

How to do logging in CakePHP

Okay, I realized this long ago but it annoys me that every time I just forget this. Sometime, when debugging CakePHP, the most direct method is to simply log an error. It’s like ‘trace’ in Actionscript or just a println() in Java. Anyway, here it is:

[code lang=”php”]$this->log(“Log anything here.”);[/code]

This can be called from the controller. Continue reading “How to do logging in CakePHP”