This has been blogged about before by me and other guys, but as I still constantly experience this problem, a little repetition won’t hurt 🙂
In many projects you see the result of System.out.println() statements on the console: statements such as “here I am” or “this should not happen”. These are often left-overs from debugging sessions and flood the log. Although, I personally think there are almost no use cases where you would use sysouts over breakpoints or conditional breakpoints, you cannot just forbid the use of them. In fact, there are good use cases I know for sysouts, e.g. debugging drag and drop where you do not want the debugger to suspend on a drag over. However, polluting the code with sysouts should be a no go. A better solution is to put the sysout statement into the break point’s condition like this:
In this way you do not pollute the code and, if you want to persist your sysouts, you can export the breakpoints.