can we use gs.log() in scoped application?

PRAVEEN AKULA
Giga Contributor

can we use gs.log() in scoped application?

1 ACCEPTED SOLUTION

siva_
Giga Guru

We can not use gs.log() in scoped applications, We can use gs.info() , gs.warn()  ,gs.error(), gs.debug() in scoped applications for logging at different levels. 

 

The reason why gs.log() cannot be used for logging in scoped applications is  it is restricted to the global scope and not accessible from a private scope. When you are in a scoped application , your scope is bound in private to that application but gs.log() has been restricted to be accessible only at a global level kind of public but not at a private application level 

 

You can use alternate logging methods for using in scoped applications and that doesnot make much difference 

Log level | Description
error (gs.error) | Logs events that might still allow the application to continue running. Setting the log level for an application to error generates error messages only, but does not generate warn, info, or debug messages.
warn (gs.warn) | Logs potentially harmful events. Setting the log level for an application to warn generates error and warn messages, but does not generate info or debug messages.
info (gs.info) | Logs informational messages that describe the progress of the application. Setting the log level for an application to info generates info, warn, and error messages, but does not generate debug messages.
debug (gs.debug) | Logs informational events that are useful for debugging an application. Setting the log level for an application to debug generates info, warn, error, and debug messages.

 

Mark this answer as correct if that really helps. 

 

Thanks,

Siva .

View solution in original post

5 REPLIES 5

senthilvaithees
Tera Guru
No we can't use gs.log in scoped application. Pls look into this link for further details https://developer.servicenow.com/app.do#!/document/content/app_store_doc_scoped_script_jakarta_c_ScopedScriptLogging?v=kingston

Alikutty A
Tera Sage
Hi, You cannot use gs.log in scoped apps but you can use gs.info(), gs.warn() and gs.error() in scoped apps. Thanks.

larralapid
Kilo Guru

Use gs.info().Locate your scoped app logs in the syslog_app_scope table. (System Logs --> System Log --> Application Logs). 

Thanks so much for defining WHERE to look for the logs.  I've been fighting with debugging in scoped apps for 2 years.  This has been so helpful.