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. Now, you can add log messages in the server.js file and then view them in the App Settings page.
Note:
1. The maximum supported length of each log is 2000 characters beyond which the log is truncated.
2. At present, viewing serverless logs is possible for custom apps that have at least one installation parameter (iparam).
Adding Logs
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
1 2 | console.info("Starting the registration for new user"); console.info(JSON object); |
1 2 | console.error("The authentication parameters are invalid"); console.error("Error details", JSON object); |
Retrieving Logs
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.