For torubleshooting mdm issues on iOS you can grab the devices system log file either via Apple Configurator or Xcode.
These are the key processes involved.
• profiled - Responsible for installation of profiles and certificates
• mdmd - Responsible for communicating with MDM server as well as tracking management of apps and accounts
• dmd - Relays management commands to others parts of the OS
• appstored - Installs and removed apps
• itunesstored - is used to verify apps from the store
For macOS use the console app and filter the results from the system log file on com.Apple.managedClient. This will filter all the relevant pieces involved in MDM on OS X.