Generally you would log with placeholders, like
logger.debug("My logger message has placeholders {}, {}, {}", some, objects, toLog);
which avoids the issue.