Main debugging is the debug log.
You can log a message to it like this:
System.debug('My Debug Message');
You can specify the level of debugging that you are shown. In order of least to most granular:
Limit for a debug log is 2mb so you want it to be less than that or some of it won’t be displayed.