Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer peopleโ€™s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer peopleโ€™s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The NetSuite Pro

The NetSuite Pro Logo The NetSuite Pro Logo

The NetSuite Pro Navigation

  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • NetSuite Customization
    • NetSuite Integration
    • NetSuite Advanced PDF Templates
    • NetSuite Reporting & Analytics Guide
    • Real-World NetSuite Examples
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • NetSuite Customization
    • NetSuite Integration
    • NetSuite Advanced PDF Templates
    • NetSuite Reporting & Analytics Guide
    • Real-World NetSuite Examples
  • Blog
  • Contact Us
Home/ NetSuite Customization Guide: Fields, Forms, Workflows & Scripts/Governance on Script Logging in NetSuite

Governance on Script Logging in NetSuite

Introduction

NetSuite imposes strict governance limits on script logging to prevent excessive storage and maintain performance across accounts sharing the same database instance. Logging is an essential debugging and monitoring tool, but if overused, it can affect system stability and data storage.

To keep things efficient, NetSuite automatically monitors logging behavior and enforces restrictions when thresholds are exceeded.


SuiteScript Logging Governance Model

NetSuiteโ€™s logging governance model is designed to balance visibility with performance:

Logging CategoryLimit / Behavior
N/log callsA company can make up to 100,000 log calls across all scripts within a 60-minute period.
System Error LogsAutomatically purged after 60 days.
User-Generated LogsAutomatically purged after 30 days.

If your script exceeds the allowed logging threshold, NetSuite automatically adjusts the log level to prevent excessive usage โ€” keeping the script running but reducing unnecessary logging output.


Automatic Log Level Adjustments

NetSuite continuously monitors script logging volume.
If a single script logs excessively โ€” for example, making 70,000 log.debug() calls within 20 minutes โ€” the system automatically raises its log level to a higher threshold such as Audit.

Example scenario:

  • Original script log level: Debug
  • Script floods logs with repetitive log.debug() entries
  • NetSuite raises log level โ†’ Audit
  • Result: Script continues running, but debug messages no longer appear in the log

You can view this new log level in the Log Level field on the scriptโ€™s Deployment page.

This automatic control prevents excessive debug logging while maintaining script execution.


N/log Module Overview

The N/log module allows developers to record execution information at varying log levels:

MethodDescriptionTypical Use
log.debug(title, details)Logs diagnostic data for development.Temporary debugging; should be removed before deployment.
log.audit(title, details)Logs key events or checkpoints.Use for business-level tracking.
log.error(title, details)Logs error details.Use for exception handling or failure tracking.
log.emergency(title, details)Logs critical system issues.Use sparingly for fatal errors only.

Tip: Use Audit or Error for production scripts and reserve Debug for sandbox testing.


Script Execution Log Storage and Retention

All script execution logs in NetSuite are stored for a limited period โ€” typically 30 days โ€” and can be accessed via multiple interfaces:

Access MethodDetails & Governance
Execution Log SubtabAvailable on script and deployment records. Logs shared across all customers on the same NetSuite database. Limited to 5 million log entries per database instance. If exceeded, logs for all tenants may be purged.
Server Script Log SearchSimilar capacity and limit of 5 million logs per instance. If the search fails to return recent logs, logs may have been purged due to over-logging.
Script Execution Log PageDisplays logs retained for 30 days, regardless of volume. Recommended for manual monitoring and filtering.

โš ๏ธ Important:
If you require long-term log retention, create a custom record or external logging mechanism (via RESTlet or middleware) to store logs beyond the 30-day limit.


Script Owner Notifications

When excessive logging is detected:

  • The script owner receives an email notification.
  • A log entry is added to the scriptโ€™s Execution Log, indicating the automatic log level change.
  • The new level (e.g., from Debug โ†’ Audit) is visible on the Script Deployment page.

These notifications help developers quickly identify and fix overly verbose logging patterns before they impact account-level performance.


Best Practices for Efficient Script Logging

โœ… Use Logging Strategically:
Reserve log.debug() for development; rely on log.audit() or log.error() in production.

โœ… Implement Conditional Logging:
Wrap logs in conditions (e.g., if (debugMode) log.debug(...)) so you can toggle verbosity easily.

โœ… Aggregate Messages:
Combine related details into a single log entry instead of multiple small ones.

โœ… Monitor Log Volumes:
Regularly check the Execution Log subtab to identify scripts that produce excessive logs.

โœ… Purge or Archive Logs:
Implement a scheduled process to periodically export and clear old logs from custom records.

โœ… Avoid Logging Inside Loops:
Logging within loops (especially during search.run().each() or for iterations) is a common cause of performance issues.


Sample Logging Pattern

Hereโ€™s a controlled example of safe, efficient logging:

/**
 * Example: Controlled Logging in SuiteScript 2.x
 */
define(['N/log', 'N/runtime'], (log, runtime) => {
    function execute(context) {
        const script = runtime.getCurrentScript();
        log.audit('Script Started', `Remaining Usage: ${script.getRemainingUsage()}`);

        try {
            // Business logic
            log.debug('Processing Record', { id: 12345, type: 'invoice' });
        } catch (e) {
            log.error('Error Processing', e.message);
        }

        log.audit('Script Completed', `Remaining Usage: ${script.getRemainingUsage()}`);
    }
    return { execute };
});

This pattern uses Audit and Error logs for operational visibility, and Debug only when troubleshooting.


Key Takeaways

  • A company can generate up to 100,000 log calls per hour across all scripts.
  • Excessive logging triggers automatic log level elevation to limit system impact.
  • Logs are retained for 30 days (user-generated) or 60 days (system errors).
  • Use the N/log module responsibly and monitor logs through the Execution Log subtab or Server Script Log search.
  • For long-term tracking, use custom records or external integrations for log archiving.

Related Reading

  • SuiteScript Governance and Usage Limits
  • Script Type Usage Unit Limits
Share
  • Facebook

Leave a ReplyCancel reply

Sidebar

Ask A Question

Stats

  • Questions 6
  • Answers 6
  • Best Answers 0
  • Users 2
  • Popular
  • Answers
  • Rocky

    Issue in running a client script in NetSuite SuiteScript 2.0 ...

    • 1 Answer
  • admin

    How can I send an email with an attachment in ...

    • 1 Answer
  • admin

    How do I avoid SSS_USAGE_LIMIT_EXCEEDED in a Map/Reduce script?

    • 1 Answer
  • admin
    admin added an answer The issue is usually caused by following Wrong script file… September 14, 2025 at 10:33 pm
  • admin
    admin added an answer Steps to send an Invoice PDF by email: define(['N/email', 'N/render',… August 28, 2025 at 3:05 am
  • admin
    admin added an answer This error means your script hit NetSuiteโ€™s governance usage limit… August 28, 2025 at 3:02 am

Top Members

Rocky

Rocky

  • 1 Question
  • 22 Points
Begginer
admin

admin

  • 5 Questions
  • 2 Points

Trending Tags

clientscript netsuite scripting suitescript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Menu

  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • NetSuite Customization
    • NetSuite Integration
    • NetSuite Advanced PDF Templates
    • NetSuite Reporting & Analytics Guide
    • Real-World NetSuite Examples
  • Blog
  • Contact Us

Quick Links

  • NetSuite Scripting
  • NetSuite Customization
  • NetSuite Advanced PDF Template
  • NetSuite Integration
  • NetSuite Reporting & Analytics

Subscribe for NetSuite Insights....

© 2025 The NetSuite Pro. All Rights Reserved