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?
dpalyca755Asked:
Who is Participating?
 
for_yanCommented:
can you say, for wexample, if your string is myString:

log.debug(myString.substring(0, Math.min(myString.length()-1,80)));
0
 
CEHJCommented:
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

http://logback.qos.ch/manual/layouts.html
0
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.