Skip Navigation
Debugging in Customer Portal with logMessage()
Answer ID 7009   |   Last Review Date 12/18/2018

How can I debug PHP code in Customer Portal?


Customer Portal


If you are experiencing an issue with your Customer Portal pages, one initial thing you may want to do is test in Reference Implementation. This can help you identify if the problem is code related, or product/configuration related. You can find some instructions on how to test in Reference Implementation here:

Answer 7008: Testing Customer Portal problems in Reference Implementation

If you are experiencing a problem with custom code, the single best way to debug the issue is to use the native logMessage() function. You can add logMessage() to your PHP scripts to either record a custom debug message:

logMessage("This is a test message");

Or to write the contents of a variable or caught exception:

catch(exception $e)

logMessage() will traverse an array and write it to the log file, but also remember that due to lazy loading in CPHP you may not always see the contents of each array element and you'll need to explicitly write it to the log to see it:

$incident = RNCPHP\Incident::fetch(123456);

Once you've added logging to your PHP script, you can view it by:

1. Going to the Customer Portal Administration Area at https://*yoursite*
2. Logging in with your admin console credentials
3. Clicking on Logs->Debug Logs in the menu

To prevent unnecessary logging, be sure to comment out or delete any logMessage() calls prior to deploying your PHP code!

Available Languages for this Answer:

Notify Me
The page will refresh upon submission. Any pending input will be lost.