Set a more reasonable max string length.

Also improve the log message to include an excerpt of the string.