Debugging apps that use the serverless feature can be a little tricky once they are in production. To make this easy, the Freshworks platform enables serverless logging so you can add log messages in the server.js file and then view them in the App Settings page.
Note: At present, viewing serverless logs is possible for custom apps that have at least one installation parameter (iparam).
You can add logs to the server.js file with one of the following severity levels.
- Info: Use this severity level to log general debug or status messages. Copied Copy
- Error: Use this severity level to log errors or warnings. Copied Copy
|console.info("Starting the registration for new user"); console.info(JSON object);|
|console.error("The authentication parameters are invalid"); console.error("Error details", JSON object);|
Once the custom app is installed, select the Settings icon and then choose the Serverless Logs tab to view the logs. Logs are displayed in different colors to reflect their severity level. To download them, click the Export button.
For apps that use the OAuth authorization scheme:
- In the Apps page, click the reauthorize icon next to the custom app for which you want to view logs. The Reauthorize the App window is displayed.
- Click Reauthorize. The app details window is displayed.
- Select the Serverless Logs tab, to view all logs.