In a privately-scoped application, which methods are used for logging messages in server-side scripts? (Choose 2 answers)
Understanding Scoped Applications:Scoped applications in ServiceNow are designed to isolate and protect application-specific code and data. Server-side scripts within scoped applications can use the gs (GlideSystem) object for logging and debugging purposes. However, not all gs methods are appropriate or valid for scoped applications.
Valid Logging Methods in Scoped Applications:
gs.info():This method logs informational messages to the system log. It is commonly used for general-purpose logging when developers need to track execution flow or display debug data. Example:
gs.info('This is an informational log message.');
gs.error():This method logs error messages to the system log. It is used to indicate problems or issues encountered during script execution. Example:
gs.error('An error occurred during script execution.');
Incorrect Options Explained:
gs.debug() (Option B): This method is not valid in scoped applications. It is a legacy logging method available in the global scope but restricted in scoped applications.
gs.iog() (Option C): This is a typographical error and not a valid gs method in ServiceNow.
gs.logError() (Option E): This is not a recognized ServiceNow API method. To log errors, gs.error() is used instead.
Best Practices for Logging:
Logging should be meaningful and avoid unnecessary entries to keep logs clean and manageable.
Avoid excessive use of logging in production environments, as it can clutter the system logs and potentially degrade performance.
ServiceNow Developer Documentation on GlideSystem (gs).
SN Pro Tips on debugging and logging practices in scoped applications.
Nan
17 days agoStephaine
22 days agoAnnita
27 days agoLai
1 month agoDonte
1 month agoKami
1 month agoCandida
2 months agoFernanda
2 months agoDesmond
2 months agoSuzan
2 months agoMattie
2 months agoRashida
2 months agoElke
3 months agoHubert
3 months agoLaila
3 months agoVirgilio
3 months agoLavelle
4 months agoSheron
4 months agoMarget
3 months ago