Added testcase for context logger and minor refactorings