improve logging recovery when print can't encode a character