Skip to main content

WatchService doesnt work for mapped network drives

1 reply [Last post]
Joined: 2008-12-06

I am using WatchService to monitor specific directories on my computer. further on, I have mapped some network paths which I also need to monitor as they contain several log files. Everytime a new file is created I wish to be informed. I noticed that I do not get any feedback when using WacthService on mapped network paths. Does any of you know the reason? How can I check if a registered directory supports monitoring or not?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2005-08-08

I assume you get events for log files created by processes on your own machine and the issue is that you aren't getting events when log files are created by other machines - is that right? If so, then the WatchService spec has wording to make it clear that it cannot guarantee events for this case:

"If a watched file is not located on a local storage device then it is implementation specific if changes to the file can be detected. In particular, it is not required that changes to files carried out on remote systems be detected. "

You might need need some form of inter-process communication to let you know about log files created by other machines.