CakePHP log output (Where is it?)

CakePHP log file output FAQ: Help, where is my CakePHP log output? I can't find my CakePHP error log output or my CakePHP debug log output.

If you're writing CakePHP log file output as shown in either of these two methods:

CakeLog::write('debug', 'Where is this message going?');
$this->log($this->data, 'debug');

but can't find this CakePHP log output in your Apache log files or PHP log files, fear not, it's somewhere else. That location is:

$app/tmp/logs/debug.log

(Where '$app' is the root directory of your CakePHP application.)

Or, if you're writing your CakePHP log output file 'error' instead of 'debug', it's going here instead: 

$app/tmp/logs/error.log

Watching CakePHP error log output

FWIW, if you're using a Linux or Unix system, a nice way to view these log files is with the Unix tail -f command in a separate terminal window, like this:

tail -f $app/tmp/logs/debug.log

The 'tail -f' command keeps displaying whatever is written to the end of the log file, which is very nice when you're developing a CakePHP app like this.

I kept expecting this CakePHP debug output to be in my MAMP PHP log file as I'm developing a new application, and I finally got the bright idea to search the $app directory for my output. After that, reading the error logging portion of the CakePHP manual won't hurt either. :)

Add new comment

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.