limiting logging

I am logging a long string to standard out for debugging using system.out.println.
How can I limit it to just the first 80 characters or so?
Who is Participating?
for_yanConnect With a Mentor Commented:
can you say, for wexample, if your string is myString:

log.debug(myString.substring(0, Math.min(myString.length()-1,80)));
CEHJConnect With a Mentor Commented:
using system.out.println

You should use a proper logging framework. Logback is the best. It will give you complete control over the length of your logged strings. Although there is quite a bit of code on this page, it's for illustrative purposes - you don't need to write any
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.