Refactoring log initialization