Added logging and lock file for database update