Instead of using System.out.print statements often, you can use Videobug to record everything and replay it later. Use Videobug on localhost for fast debugging on your localhost.
Set token value to localhost-token and videobug will store the logs on your localhost machine.
How does it work on localhost?
Enabling Localhost Debugger
Go inside the credential window, and click on Use Offline button as shown below.
Whenever your code crashes or an exception occurs, you can refresh inside the Exceptions tab and see all the exceptions in your code.
Click on any row and fetch session, you will be taken in the debugging tab, you can go back or forward in time and see the variables.
Search Code Executions
You can search code executions by the variable values. For example, if you send email@example.com to your code and want to see the code execution for this email id, you can do so using Traces
The below code shows the search done for code execution where firstname.lastname@example.org was passed as a variable value.
This is very relevant for bugs where for particular users something went wrong and no stack trace is available. For example, for email@example.com, the checkout amount was $99.9 and the amount sent to bank was $100. You would want to trace the code execution line by line for such users.
Use Videobug on localhost for tracing back your code for free!