Writing to Log Entry file

mjocasio23
Tera Expert

I am trying to write to a system log when a business rule is used to check the change of a field value in a application.

The rule works fine..... Where Im having problem is , I have an include script that Im trying to write to the above Log Entry file.

When I execute the App and submit the form, I get the following error. I created the definition thru a module in the application which is in the scope mentioned above.I also by selecting the link type of the module, I cannot see the log mention above so I select the application log and im getting the scope error..... Why I cannot see the Log Entry when I search for the table associating of this module link type.         selecting the whatever from the pool of tables thru the module :Application log i get the out scope error.

Function log is not allowed in scope x_hhsa2_hhs_dfas_b. Use gs.debug() or gs.info() instead

4 REPLIES 4

SanjivMeher
Kilo Patron
Kilo Patron

gs.log doesn't work in scoped app. You will have to use gs.info() or gs.debug(). replace gs.log with gs.info() in your script include



Please mark this response as correct or helpful if it assisted you with your question.

mjocasio23
Tera Expert

Is there a way around this.,.... Like making the modules global scopy instead of application scope only?


If it is a scoped app, you don't have an option but to use gs.info().



Scoped Script Logging - ServiceNow Wiki



Log LevelDescription
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 error 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.

Please mark this response as correct or helpful if it assisted you with your question.

mjocasio23
Tera Expert

I got it it does write to the app log..... thanks