How can one debug imagent issues? I have just upgraded to OS X 10.8 Mountain Lion and am attempting to use Facetime and iMessage.  Upon entering my Apple ID into the respective applications and attempting to sign in, I receive the following error message:


  The server encountered an error processing registration.  Please try again later.


Whilst I assume that imagent proceeded beyond the authentication stage (as providing incorrect credentials results in a different error message), I am unable to ascertain exactly what went wrong.  I cannot find any log file (nor any option to enable logging) that shines light on the subject.  Is it possible to audit imagent activity?

I have found various suggestions, some of which appear to have worked for others:


Force quit the imagent process;
Reset /etc/hosts to default state;
Enable ntp;
Fix permissions and/or delete ~/Library/Preferences/com.apple.imagent.plist;
Delete certain Apple-issued certificates from the user's login keychain;
Use Google's public DNS resolvers;
Disable all firewalls and packet filters;
Delete the contents of /Library/Preferences/SystemConfiguration;
Reset NVRAM/PRAM;
Reboot.


I have tried all of the above, with no improvement.

I have tried using two different Apple IDs: one a simple MobileMe account (ending @me.com) that has been transferred to iCloud; the other an old .Mac address (ending @mac.com) with which additional non-Apple email addresses have been associated and verified.  The computer is connected to iCloud with the former account; and I have previously used the latter account successully with Facetime on the same computer (when running Lion) and with iMessage on my iPhone and iPad.

I am at a loss to understand how I should proceed.  Whilst I would be grateful for any suggestion that fixes the problem, I would be far more grateful for a canoncial answer that describes how imagent issues can be debugged in the future: e.g. how to enable logging or similar.
I removed the file

/Library/Preferences/SystemConfiguration/NetworkInterfaces.plist


and after a reboot the error

The server encountered an error processing registration. Please try again later.


was gone (Mac OS X creates a new 'NetworkInterfaces.plist' file during the boot process). 

The file 

/Library/Preferences/SystemConfiguration/NetworkInterfaces.plist


contains informations about the network interfaces, it looks like the upgrade from 10.7 to 10.8 broke something (at least on my system).

'imagent' itself has no debug option but you can try tools like 

dtruss 


or the

Instruments.app


to monitor the program. Instruments.app is part of XCode and a GUI to dtruss.

Or you can monitor the network traffic between imagent and the server.