jul*_*lio 5 php joomla logging joomla1.7
我正在使用基于Joomla平台11构建的新Joomla 1.7系统 - 我早期版本的Joomla中的所有日志代码都不再起作用(它们似乎是在编写日志条目但语法不正确,因此消息是空白的) .
有没有人知道新版JLog的正确语法?这是我现有的代码 -
$log = &JLog::getInstance('test.log.php');
$log->addEntry(array('COMMENT' => 'A test Logging message'));
Run Code Online (Sandbox Code Playgroud)
这会创建日志文件,但实际的日志条目如下所示:
#<?php die('Forbidden.'); ?>
#Date: 2011-08-08 16:59:42 UTC
#Software: Joomla Platform 11.1 Stable+Modified [ Ember ] 01-Jun-2011 06:00 GMT
#Fields: date time priority clientip category message
2011-08-08 16:59:42 INFO 127.0.0.1 -
Run Code Online (Sandbox Code Playgroud)
我搜索了Joomla文档和网页,没有找到如何使用这个类的例子.
谢谢!
是的,在Joomla 1.7中,日志记录确实发生了变化:
// Include the JLog class.
jimport('joomla.log.log');
// Add the logger.
JLog::addLogger(
// Pass an array of configuration options
array(
// Set the name of the log file
'text_file' => 'test.log.php',
// (optional) you can change the directory
'text_file_path' => 'somewhere/logs'
)
);
// start logging...
JLog::add('Starting to log');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3976 次 |
| 最近记录: |