N/log Module for Script Execution Logging in NetSuite
N/log module enables effective logging of script execution details, enhancing debugging and monitoring capabilities.
The N/log module is a crucial tool in NetSuite that allows developers to log details about script execution efficiently. This capability is particularly essential for debugging and maintaining scripts to ensure they function as intended.
What is the N/log Module?
The N/log module provides methods to facilitate logging within SuiteScripts. Developers can utilize both the N/log module and the global log object to record relevant execution information.
How to Access the N/log Methods
Logging methods can be accessed through the following methods:
- Use the
logobject directly for running scripts. - Use the N/log module for more detailed control and configuration.
Log entries generated using the N/log module can be viewed in various interfaces, such as:
- Execution Log subtab of the script deployment record.
- SuiteScript Debugger during script debugging sessions.
- Script Execution Logs page under Customization > Scripting > Script Execution Logs.
Guidelines for Using the N/log Module
When using the N/log module, here are some essential guidelines to keep in mind:
- Each company is limited to a maximum of 100,000 log object method calls within any 60-minute window across all scripts. Exceeding this limit will prompt NetSuite to automatically adjust the logging level for scripts detected to be logging excessively.
- Logs that are older than 30 days will be purged automatically by NetSuite.
- The storage limit for logs in the Server Script Log and Execution Log subtab is capped at 5 million per database instance. Since log persistence isn’t guaranteed, consider using custom records for long-term log storage.
- Note that the Execution Log subtab documents not only log entries but also any system messages or errors returned by NetSuite. For comprehensive error handling, refer to the N/error module.
Additional Resources
For more details on error handling and logging practices in NetSuite, consider reviewing the corresponding sections on the N/error module and its members. This can provide further insights into managing errors and ensuring better control over your scripts' execution flows.
Frequently Asked Questions (4)
How can I view logs generated by the N/log module?
What logging limits does NetSuite impose when using the N/log module?
What happens to logs that are older than 30 days in NetSuite?
Does the Execution Log subtab in NetSuite only document log entries?
Was this article helpful?
More in SuiteScript
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
- Enhancements to SuiteScript User Role Context Clarification
SuiteScript updates clarify the user and role contexts for script executions, improving deployment understanding and management.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category