Coldfusion:运行时在 CF 页面上显示日志,就像 Console 或 Putty

Coldfusion : Runtime show logs on CF page just like Console or Putty

我在此应用程序中开发应用程序,我必须显示 运行 时间日志,无论何时出现任何更新,它都应该以正确的方式显示。我的意思是说它应该像控制台一样在 coldfusion 页面上显示日志。我知道在 AJAX 的帮助下是可能的,但我不知道在 coldfusion 中该怎么做。我不想每秒 运行 调度程序。我还有其他方法可以做到这一点吗?

如果您需要更多详细信息或者我不清楚,请告诉我......

谢谢

DirectoryWatcherGateway

The DirectoryWatcherGateway event gateway sends events to the listener CFC when a file is created, deleted, or modified in a directory. The watcher runs in a thread that sleeps for an interval specified in the configuration file, and when the interval has passed, checks for changes since the last time it was awake. If it finds added, deleted, or changed files, it sends a message to a listener CFC. You can configure separate CFCs for add, delete, and change events, or use a single CFC for all events. The source for this event gateway is located in the gateway/src/examples/watcher directory.

http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-77f7.html

一旦检测到修改(通过轮询),那么您可以使用 Linux 中的 tail return 最后 x 行数:

或 Window 的 Powershell Get-Content -tail https://technet.microsoft.com/en-gb/library/hh849787.aspx

最后,您可以使用Sever Sent Event (essentially ajax long polling) or cfwebsocket(CF10 或更高版本)将最后x 行推送到客户端。