Error with Logging in zend
Hi This is my code to generate logs
$writer = new Zend_Log_Writer_Stream('http://localhost/clms/public/log');
$logger = new Zend_Log($writer);
$logger->info('Informational message');
but am getting an exception
开发者_运维技巧Fatal error: Uncaught exception 'Zend_Log_Exception' with message '"http://localhost/clms/public/log" cannot be opened with mode "a"' in C:\xampp\htdocs\CLMS\library\Zend\Log\Writer\Stream.php:69
Any body please tell me how to make the logs clearly. Thanks for helping me.
You need to provide the path to the log file, not a URL, so you probably want:
$writer = new Zend_Log_Writer_Stream(APPLICATION_PATH.'/../public/log');
the error you are getting is because the logger can't write to the path you provided (which makes sense since you gave it a URL). If you are still getting the error after changing this you just need to make sure the directory/log file is writable by the user the webserver runs as.
精彩评论