top of page

Replace Deprecated Logging Methods in Scoped App

In ServiceNow scoped applications, using gs.log() can lead to script failures because it is not supported in scoped environments. Instead, developers should use scoped logging methods like gs.info(), gs.warn(), or gs.error() to ensure compatibility and maintain proper logging practices. Replacing deprecated logging methods prevents execution issues and ensures logs are correctly captured.


Resolution Steps

1. Replace with Scoped Logging Methods

  • Update the script by replacing gs.log() with an appropriate scoped logging API, such as:

    • gs.info("Your message here") – for general information logs.

    • gs.warn("Your warning message") – for potential issues.

    • gs.error("Your error message") – for critical errors.


Before:

gs.log is a deprecated logging method
gs.log is a deprecated logging method

After:

gs.info is an appropriate logging method
gs.info is an appropriate logging method

By replacing gs.log() with appropriate scoped logging methods, you ensure that logs are captured correctly without causing script failures in ServiceNow scoped applications. Adopting best practices for logging improves debugging, performance, and maintainability.

For more detailed guidance on resolving this issue, please contact us at support@dt-advisory.ch.


bottom of page