added explicit flush but it may not be necessary: #MSG-189 In Progress
migrating to logging module: #MSG-188 In Progress