[GH-ISSUE #113] [Feature Request] Add Rigorous file checking ability to harverster #88

Closed
opened 2026-02-26 05:31:18 +03:00 by kerem · 5 comments
Owner

Originally created by @JavaScriptDude on GitHub (Feb 17, 2014).
Original GitHub issue: https://github.com/NarrativeScience-old/log.io/issues/113

Its well know that fs.watch does not work in all cases. I can confirm one solid test case illustrating this issue:

On windows use

ping -n 1000 www.google.com > c:\temp\ping.log

When watching ping.log in log.io, fs.watch will not detect changes unless certain external events occur such as the user refreshing windows explorer looking at the folder.

This feature request is to add a new option for harvester to allow for rigorous file checks where the user can define a threshold for checking and the harvester runs a parallel fs.stat check against the file being watched.

I have implemented this in a fork of bunyan CLI which uses some code borrowed from harvester.js. You can see the the preliminary code here: https://github.com/JavaScriptDude/node-bunyan/trunk/bin/bunyan. See the -r option.

FYI - My bunyan fork is to implement tail -n and tail -f functionality into bunyan CLI and hopefully get it integrated back into the main bunyan tree.

Originally created by @JavaScriptDude on GitHub (Feb 17, 2014). Original GitHub issue: https://github.com/NarrativeScience-old/log.io/issues/113 Its well know that fs.watch does not work in all cases. I can confirm one solid test case illustrating this issue: On windows use ``` ping -n 1000 www.google.com > c:\temp\ping.log ``` When watching ping.log in log.io, fs.watch will not detect changes unless certain external events occur such as the user refreshing windows explorer looking at the folder. This feature request is to add a new option for harvester to allow for rigorous file checks where the user can define a threshold for checking and the harvester runs a parallel fs.stat check against the file being watched. I have implemented this in a fork of bunyan CLI which uses some code borrowed from harvester.js. You can see the the preliminary code here: https://github.com/JavaScriptDude/node-bunyan/trunk/bin/bunyan. See the -r option. FYI - My bunyan fork is to implement tail -n and tail -f functionality into bunyan CLI and hopefully get it integrated back into the main bunyan tree.
kerem closed this issue 2026-02-26 05:31:18 +03:00
Author
Owner

@Ugenx commented on GitHub (Jul 21, 2015):

Hey did you ever get anywhere with this? Currently running into the same issue with log files in our .NET projects not getting updated until someone opens them in explorer or another external event forces the modified date to get updated.

<!-- gh-comment-id:123509402 --> @Ugenx commented on GitHub (Jul 21, 2015): Hey did you ever get anywhere with this? Currently running into the same issue with log files in our .NET projects not getting updated until someone opens them in explorer or another external event forces the modified date to get updated.
Author
Owner

@JavaScriptDude commented on GitHub (Jul 22, 2015):

No. I wrote a fork and got it working actually but it did not get pulled back. You can take a look at my fork and maybe it can be merged to the current head without any conflicts.

The reason I stopped pushing was that I since switched away from Windows as my development platform.

Personally, I see this as a large gap in the bunyan library as the best way to debug any app is with a tail window spitting out logs in real time =) Poor Windows developers don't have this opportunity with Bunyan and this makes it kind of weak on the Windows platform IMO.

<!-- gh-comment-id:123516871 --> @JavaScriptDude commented on GitHub (Jul 22, 2015): No. I wrote a fork and got it working actually but it did not get pulled back. You can take a look at my fork and maybe it can be merged to the current head without any conflicts. The reason I stopped pushing was that I since switched away from Windows as my development platform. Personally, I see this as a large gap in the bunyan library as the best way to debug any app is with a tail window spitting out logs in real time =) Poor Windows developers don't have this opportunity with Bunyan and this makes it kind of weak on the Windows platform IMO.
Author
Owner

@Ugenx commented on GitHub (Jul 22, 2015):

From my reading it's more a limitation of NTFS than anything else; files with an open handle don't have their modified timestamp updated unless it is opened by another process which then forces the update. You can read more about it here, though the English is a little rough around the edges: http://goo.gl/mC2Erx

<!-- gh-comment-id:123517465 --> @Ugenx commented on GitHub (Jul 22, 2015): From my reading it's more a limitation of NTFS than anything else; files with an open handle don't have their modified timestamp updated unless it is opened by another process which then forces the update. You can read more about it here, though the English is a little rough around the edges: http://goo.gl/mC2Erx
Author
Owner

@msmathers commented on GitHub (May 22, 2020):

Since v0.4.14, log.io uses the chokidar file watching library, which provides robust file watching customization. Users can specify which file watching mechanism should be used for specific file paths, including polling.

Closing for now, feel free to open a new issue if chokidar doesn't provide the functionality you're seeking.

<!-- gh-comment-id:632714778 --> @msmathers commented on GitHub (May 22, 2020): Since v0.4.14, log.io uses the [chokidar](https://github.com/paulmillr/chokidar) file watching library, which provides robust file watching customization. Users can specify which file watching mechanism should be used for specific file paths, including polling. Closing for now, feel free to open a new issue if chokidar doesn't provide the functionality you're seeking.
Author
Owner

@JavaScriptDude commented on GitHub (May 22, 2020):

No issues. Thanks for reviewing and closing.

<!-- gh-comment-id:632766527 --> @JavaScriptDude commented on GitHub (May 22, 2020): No issues. Thanks for reviewing and closing.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/log.io-NarrativeScience-old#88
No description provided.