Using the log function
The log() function takes two parameters. The first is the message you'd like written to the log file. By default, this error message is written to the error log found in app/tmp/logs/error.log.
Простой текст//Executing this inside a CakePHP class:$this->log("Something didn't work!");//Results in this being appended to app/tmp/logs/error.log2007-11-02 10:22:02 Error: Something didnt work!
The second parameter is used to define the log type you wish to write the message to. If not supplied, it defaults to LOG_ERROR, which writes to the error log previously mentioned. You can set this second parameter to LOG_DEBUG to write your messages to an alternate debug log found at app/tmp/logs/debug.log:
Простой текст//Executing this inside a CakePHP class:$this->log('A debugging message.', LOG_DEBUG);//Results in this being appended to app/tmp/logs/debug.log (rather than error.log)2007-11-02 10:22:02 Error: A debugging message.
Your app/tmp directory must be writable by the web server user in order for logging to work correctly.


Коментарии:
Добавить коментарий