6

Looking for input on how to solve the following problem. My ColdFusion 9 app has a simple logger that writes text to a file. On my dev machine, the file is local so I can use either 'tail -f' or CFB's TailView to watch it. I'd like a tool to watch it when it's deployed on the production server. The catch: production is at a shared CF hosting provider which doesn't allow RDS file access or a directory-watcher gateway. I'm wondering about a page with a meta refresh tag or if I want to get more fancy, something AJAXy to the same effect. Thoughts? Any tools that already exist for this?

I may experiment with this but am hoping there is something out there "more complete" : following a log file over http

4

4 回答 4

1

您可以使用以下 PHP 脚本:

<?php
header("Content-Type: text/plain");
set_time_limit(0);
passthru("tail -F -n +0 log.txt");
?>
于 2011-11-05T21:09:28.873 回答
0

以下伪代码受此Java 解决方案的启发,根本未经测试:

if (NOT structKeyExists(application, "log") {
    application.log = fileOpen('log.txt', 'read')
}

while(NOT FileisEOF(application.log))  {
    writeOutput(fileReadLine(application.log) & "<br/>");
}

将其放在具有元刷新的页面上,我认为您可能正在开展业务。

于 2011-05-31T15:33:27.963 回答
0

我为我的用例 ( tail.sh )创建了以下 bash 脚本

它使用“lynx”获取文件列表,从中获取所需的文件大小,并在无限循环中尝试获取文件的一部分

于 2013-04-19T15:14:31.170 回答
-1

I know it's pretty old school, but have you considered logging to a database? If you timestamp the log entries in the table you could use HTTP Caching headers to communicate to the server what new data you should see.

于 2011-06-01T15:42:26.207 回答