How to log your website using cakephp
Cakephp is a good framework, it is a rapid web development framework for building any type of website. As a framework, cakephp has many built in feature. One of cakephp feature is build in logging system. Developer can easily log their application using cakephp.
Log function that can be accessed through your controller easily. You can save or add new log into error log or debug log, or you can make new log file. All file will be placed inside CAKEPHP_FOLDER/app/tmp/logs folder
default sintax that added to CAKEPHP_FOLDER/app/tmp/logs/error.log
$this->log("error message log");
log for debugging that added to CAKEPHP_FOLDER/app/tmp/logs/debug.log
$this->log('debug message log', LOG_DEBUG);
log to specific filename
$this->log('daily log', 'daily');
One of log purpose is to track user access on our website. Here is a sample of user access log or tracking user access using cakephp :
$this->log($this->RequestHandler->getClientIP() ."\t". $this->params['url']['url'] ."\t". Controller::referer(), 'access_log'. date('dmY'));
One thing you need to remember is that the log function add the datetime automatically for new log.
So this is how we can track user access or create log for catch the error message or for debuging in cakephp. I hope this article help you.

