来源于:http://trac.seagullproject.org/wiki/Howto/Logging
注意:要使用SGL::logMessage(),你要在Seagull Admin → General → Configuration → Logs打开日志功能
SGL::logMessage(String $msg[, String $file, Int $line, Constant $priority]);`.
SGL::logMessage('I went here', PEAR_LOG_DEBUG);
SGL::logMessage(null, PEAR_LOG_DEBUG); // Just record date/level/class/function
SGL::logMessage('Parameter foo is set to ' . $foo); // Record at INFO level
注意 CLASS 和 FUNCTION 事实上是被logMessage这个函数自动设置和输出的。
输出样例:
Aug 26 14:50:47 Seagull [debug] sgl_controller→_displaypage:
提示:如果你正在使用UNIX/LINUX系统,你可以使用logrotate来控制你的日志文件:
Logrotate.conf: ============ # see "man logrotate" for details # rotate log files weekly weekly # keep 4 weeks worth of backlogs rotate 4 # create new (empty) log files after rotating old ones create # uncomment this if you want your log files compressed #compress # RPM packages drop log rotation information into this directory include /etc/logrotate.d
在logrotate.d目录内创建一个名为seagull的文件,包含如下内容:
/var/log/php_log.txt {
missingok
notifempty
}
查看Howto/DebuggingIdeas获取更多资料。
注意:在Apache 1.3.x服务器上,如果你的日志文件超过2GB,它将会导致显示空白页面。