Lock log fix

"Lock acquisition failed" log was coming everytime method inside `with_lock` failed. This was because `log_with_time` errback handler was added after invoking the method. Now, adding it immediately after calling `lock.acquire`. Also, rewrote all the tests to consider logs.