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:

$this->log("Log anything here.");

This can be called from the controller.

And can find the log here:

\app\tmp\logs\error.log

Maybe someone who drops by may just find this useful too.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>