SuiteScript - "N/log" Module - Script Execution Logs | Debug, Audit, Error, Emergency | NetSuite

Опубликовано: 03 Октябрь 2024
на канале: Sweet Scripts Studios
459
11

SuiteScript - N/log Module Script Execution Logs | Debug, Audit, Error, Emergency | NetSuite

N/log Module
Use the N/log module to manually access methods for logging script execution details. These methods can also be accessed using the global log object. For more information about the global log object, see log Object.

Log messages appear on the Execution Log tab of the script deployment for deployed scripts, or on the Execution Log tab of the SuiteScript Debugger if you are debugging a script. Log messages also appear on the Script Execution Logs page at Customization , Scripting , Script Execution Logs.

N/log Module Guidelines
The following guidelines are provided for use of the N/log module:

NetSuite governs the amount of logging that can be done in any specific 60 minute time period. A company is allowed to make up to 100,000 log object method calls across all of their scripts. Script owners are notified if NetSuite detects that one script is logging excessively and automatically adjusts the log level.

NetSuite purges logs older than 30 days.

The Server Script Log search and the Execution Log tab of script records and script deployment records have a log storage limit of 5 million per database. Because log persistence is not guaranteed, You should use custom records if you want to store script execution logs for extended periods. The Script Execution Logs page at Customization , Scripting ,Script Execution Logs does not share the same database limit.

The Execution Log tab also lists notes returned by NetSuite such as error messages. For more information, see N/error Module.

If you deploy a client script to a form using Form.clientScriptFileId or Form.clientScriptModulePath, using the N/log module adds the logs to the deployment of the parent script. The parent script can be either a beforeLoad user event script or a SuiteScript 2.x Suitelet Script Type.

When an object (that is not a string) is passed to a log object method, NetSuite runs JSON.stringify(obj) on any values that are passed as the details parameter and equal a JavaScript object.


Using Log Levels
Use the log methods along with the Log Level field on the script deployment to specify which log messages are written to the Execution Log on the script deployment. This is useful during the debugging of a script or for providing useful execution notes for auditing or tracking purposes.

Log levels on the script deployment and N/log module methods act as a filter on the amount of information logged.

⏱️⏱️VIDEO CHAPTERS⏱️⏱️

00:00 - Introduction to the N/log module
00:25 - Using N/log module in scheduled script
02:18 - Script Record and Script Deployment
03:00 - functions in N/log Module
03:50 - Log levels in Script Deployment
04:32 - Script Execution to log different logs
05:52 - Exploring Log levels in Script Deployment
06:45 - Exploring Log level Table
07:25 - Checking output
08:28 - View on Execution Logs and Filters on Script Deployment Execution log
09:55 - Script Execution Logs Page