CakePHP log(日志)操作

CakePHP 的日志文件放置在目录 app/tmp/logs/ 下,下面是几个例子
//Executing this inside a CakePHP class:
$this->log("Something didn't work!");

//结果追加到  app/tmp/logs/error.log
2007-11-02 10:22:02 Error: Something didn't work!

//Executing this inside a CakePHP class:
$this->log('A debugging message.', LOG_DEBUG);

//结果追加到 app/tmp/logs/debug.log (rather than error.log)
2007-11-02 10:22:02 Error: A debugging message.


//Executing this inside a CakePHP class:
$this->log('A special message for activity logging', 'activity');


//结果追加到 app/tmp/logs/activity.log (rather than error.log)
2007-11-02 10:22:02 Activity: A special message for activity logging

很明显,activity是你自定义的日志,所以你得保证你的程序对tmp目录有写权限。

你可能感兴趣的:(java,cakephp)