Several fixes to logging code.