Im developing application in this application, I have to show runtime logs whenever any update come it should show right way. I meant to say it should show log on coldfusion page just like console. I know it is possible with the help of AJAX but I don’t know how do in coldfusion. I don’t want to run scheduler every second. Is there any other way I can do this ?
If you need any more details or if im not clear please let me know …
Thanks
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.
Once it's detected modified (by polling), then you can return the last x number of lines using tail
in Linux: https://stackoverflow.com/a/16375840/35634
Or Get-Content -tail
in Window's Powershell https://technet.microsoft.com/en-gb/library/hh849787.aspx
Lastly, you may use Sever Sent Event (essentially ajax long polling) or cfwebsocket (CF10 or above) to push the last x lines to the client.