I am trying to use Java Logger. I get my logger file (name.log) with the content, it works and I also get an empty name.log.lck
file.
Why does this file appear, what program is creating them and how I can remove this behavior?
An LCK file is an access control file used to "lock" a database or other file from being opened or changed by more than one user at a time. It prevents users from accidentally overwriting changes and possible data corruption.
Lock files are created when a virtual machine is powered on. Their purpose is to prevent multiple VMware processes from accessing the same virtual machine at the same time. The existence of a lock file indicates to VMware that the associated virtual machine is powered on.
.lck
is used by the handler(file handler) to lock the file in order to delete this file. You need to close the Handler that is associated with that logger object before you close your program.
Here is sample lines how you can close associated handler:
for(Handler h:log.getHandlers())
{
h.close(); //must call h.close or a .LCK file will remain.
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With