通过 HTTP 在 Web 服务器上跟踪文本文件 [英] Tail a text file on a web server via HTTP

查看:23
本文介绍了通过 HTTP 在 Web 服务器上跟踪文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

寻找有关如何解决以下问题的意见.我的 ColdFusion 9 应用程序有一个简单的记录器,可以将文本写入文件.在我的开发机器上,该文件是本地文件,因此我可以使用tail -f"或 CFB 的 TailView 来观看它.当它部署在生产服务器上时,我想要一个工具来观看它.问题:生产位于共享 CF 托管服务提供商处,它不允许 RDS 文件访问或目录观察器网关.我想知道一个带有元刷新标签的页面,或者如果我想变得更花哨,AJAXy 也能达到同样的效果.想法?任何已经存在的工具?

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?

我可能会对此进行试验,但希望有一些更完整"的东西:通过http跟踪日志文件

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

推荐答案

你可以使用以下 PHP 脚本:

You can you the following PHP script:

<?php
header("Content-Type: text/plain");
set_time_limit(0);
passthru("tail -F -n +0 log.txt");
?>

这篇关于通过 HTTP 在 Web 服务器上跟踪文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆