4

I wrote a shell program on CakePHP 2.1, and I wanted to write log. So I wrote like below.

CakeLog::write(LOG_DEBUG, $msg);

I want to write the $msg to debug.log, but it wrote to error.log.
Is there someone who solve this problem?
Please tell me how to write to debug.log.

Thanks.

3 Answers3

1
CakeLog::write('debug', $msg);
arilia
  • 9,373
  • 2
  • 20
  • 44
  • Thanks, arilia. I tried your code, but it seem to not take effect. But I read the source code of CakeLog, and find out that it should be take effect... I don't know why it doesn't work. But it's my pleasure you answered this ! – Makoto Tano Oct 17 '13 at 11:48
1

At first, enable debug in /app/config/core.php:

Configure::write('debug', 1);

At second, write your log into /app/tmp/logs/debug.log using the following code:

Debugger::log("My Log");
Simon
  • 4,157
  • 2
  • 46
  • 87
-1

Make sure to include

App::uses('CakeLogInterface', 'Log');

at the top of your shell or it won't work