Make sure log messages are trimmed correctly for clean log output.