I found a bug in logback that arises when it tries to delete a file that something else (such as an external process) holds a reference to. Usually, the issue goes away if a I close the external process, but I have also experienced that, instead of a single file handle to the logfile that was to be deleted, suddenly I have two file handles for that Java process to the same file. To me, that seems like either two different classes are holding on to the same file, or there are two threads contending for the same resource.
In any case, I would like to know what is holding on to the file. How can I get to know that? All I have to work with is the name of the file and the process id.
Some casual browsing mentions taking a heap dump of the process and inspecting it using Visual VM and the OQL query language, but I am not totally sure how to do that on a Windows server, as the examples have all targetted Linux and its system of file descriptors.