致命错误:未捕获的异常' Zend_Log_Exception'视窗

时间:2014-11-29 12:42:55

标签: windows zend-framework wampserver httpd.conf

我是Zend Framework的新手,我正在使用WampServer,我想要一个保存日志的文件夹,  
我将httpd.config修改为:

<VirtualHost *:80>

ServerName phpweb20

DocumentRoot C:\wamp\www\phpweb20\htdocs

SetEnv APPLICATION_ENV "development"

<Directory C:\wamp\www\phpweb20\htdocs>

DirectoryIndex index.php

AllowOverride All

Order allow,deny

Allow from all

</Directory>

</VirtualHost>

我将主机添加到 C:\ windows \ sys32 \ drivers \ etc
另外,我在系统变量中添加了路径
这是我的文件目录:
enter image description here
首先,在我的 setting.ini 中,在[development]中我插入了logging.file:

[development]

database.type       = pdo_mysql
database.hostname   = localhost
database.username   = phpweb20
database.password   = myPassword
database.database   = phpweb20

paths.base      = /../phpweb20
paths.data      = /../data
paths.templates = /../phpweb20/templates

logging.file = /../data/logs/debug.log

另外,我将此代码添加到 index.php

 $writer = new Zend_Log_Writer_Stream('../data/logs');
 $logger = new Zend_Log($writer);
 $logger = new Zend_Log(new Zend_Log_Writer_Stream($config->logging->file));
 Zend_Registry::set('logger', $logger);

但出现错误: 致命错误:带有消息'“../data/logs”的未捕获异常'Zend_Log_Exception'无法使用模式“a”'打开,我该如何解决?

1 个答案:

答案 0 :(得分:1)

尝试更改您的路径:

logging.file = /../data/logs/debug.log

为:

logging.file = APPLICATION_PATH "/../data/logs/debug.log"

不要忘记数据/日志目录的合适权限。

此外,$ writer在你的代码中是不必要的,因为你用内联创建的writer覆盖了$ logger。

然后删除:

$writer = new Zend_Log_Writer_Stream('../data/logs');
$logger = new Zend_Log($writer);

来自你的代码。