Best logging and process locking in right place