Developing apps can be fun and rewarding, especially when everything goes according to plan and it works!
Sadly, it's not always rainbows and sunshine. For these cases, we got your back! Debugging your application is made easy thanks to standard tools in the Betty Blocks platform.
After reading this article, you'll know:
What the debugger can do
Where the debugger can be found
How to turn on debugging
The pros and cons of debugging
What is debugging?
After creating an action, endpoint, or basically everything in your application, you want to try it out. If you did everything right, it should deliver the expected results. Happy days.
It's also possible the application doesn't do exactly what you expected it to do. There can be multiple reasons:
The process is in conflict with other parts of your application.
The result of the process has a different outcome.
The process throws an error.
As a builder, you need to know what went wrong, where it happened, and most importantly: why?
Using debugging tools will pinpoint exactly where the issue resides and gives you tips on how to fix is.
Where can I find this debugger?
Our debugging tools can be found in all parts of the platform where users can initiate a process, and the platform needs to execute certain steps. This can be divided in 2 main sections:
On every action, page or endpoint, you'll find the option to turn on debugging and start working on a solution. The results of debugging can be found in the Logs, found under Tools.
How to turn on debugging?
Time to get things done. With some background knowledge on the debugger, we're going to turn it on.
Pick an action of your choice, ideally one that's throwing errors.
Open the action's settings by clicking Edit.
Scroll down until you see 2 checkboxes, saying Debug action and events and Log execution of action.
Turn them on and click Save.
Pick a page of your choice, ideally one that's throwing errors.
Open a page in the Page Builder and click on the Settings tab.
Look for the Enable debug logging checkbox and turn it on.
States of debugging
Luckily, the platform always provides some insight on your actions when things go awry. Even when debugging is turned off.
If debugging it turned
off, and an action is completed successfully, the logs won't contain any information. If the action does not complete successfully, or an error occurs, a log entry will be available for that process. This contains the timestamp of when started, the failed process, used variables and the error message.
Log execution of action
This option is only available for Actions. With this setting, only the initiation of the action is logged, providing log entries containing the timestamp and the action itself.
This is the most detailed version of debugging.
Available for Actions, Pages, and Endpoints, this provides a start to end insight of the process.
The entries in your application Logs will contain the following information about the process:
Timestamp of when started.
Total duration of process.
Link to the process initiated.
Icons indicating what information is included.
Duration of each step within process.
Message containing information of each step, including optional values set by the builder.
Used variables per step.
Errors and warnings.
The user that initiated the process.
More information about what can be found in the Logs can be found here: Logs Reference
Using debugging tools are crucial when developing. However, don't go overboard on it. There are some consequences to using the debugger.
You'll see exactly what's happening and where. Each step is tracked, analyzed and saved for you to look in to.
Saving each step as a log entry requires performance of your application. Performance that could otherwise be assigned to executing the action. This results in actions and pages being slower and taking longer to complete when debugging is turned on, than when debugging is turned off.
Debugging is awesome, but use it wisely. Only use extended debugging during development and when you're encountering errors that need further attention.
When you're done debugging and the process is working as expected: Turn debugging off!
Having a hard time debugging? Not sure how to read the logs? Take a look at this article: What are logs and how to read them?