Debug or view status of a @future method

Future methods can be debugged in two ways. First, you can open the developer console and perform the action that causes the future method to be called. Second, you can enable debug logs in Setup / Monitoring / Debug Logs.

As for telling if they have executed, check out Setup / Monitoring / Apex Jobs. They will appear here with a status.


The best design to have future method would be to enclose all the required logic in a separate class/method. The future method should just invoke the required logic. So, essentially you can execute your logic from anonymous apex or test classes to validate if its working as expected.

You can monitor debug logs by checking logs via Setup / Monitoring / Apex Jobs.

In addition to that, for critical business cases, you can also create a custom object, to store all such requests and their outcome (success/ error) along with appropriate error message, stacktrace.

Tags:

Future

Apex