Fix #1153 Cleanup logging code