Notifications

326 views

Overview


Although the default setting in a ServiceNow instance is generally to log most messages for a scoped application to the syslog table and localhost files, there are a few properties that can be used to configure and adjust how and where this logging occurs.  These are the logging.destination and the logging.verbosity properties.

Specifying and adjusting these properties allow the ServiceNow administrator to determine specifically what level of messages are logged and where those messages will be logged.

General Information


These properties are not created by default when a new Scoped Application is created.  However, they can easily be created directly on the instance or through the Studio application.  If creating the property directly from the application, ensure to first set your current scope to be that for which you want to configure this property.

The property should have a prefix consisting of the scope name of the scoped application (i.e. x_sn_newapp) to which it should be applied to.  This prefix then scopes the property to a specific scoped application found on the instance.  Several of the out-of-box and ServiceNow Store applications may contain this system property as specified for that application, however, by default, most do not.

The logging.destination System Property


The first system property we will examine is the logging.destination property.  This property determines the target of logging messages for the scoped application.  There are two possible values that can be used for this property:

  • FILE - Specifying the value as FILE indicates that logging messages for this scoped application should only be sent to the localhost file.  Thus, the messages will appear in the localhost logs but not the syslog table on the instance.
  • DB - Specifying db in the Value field for this property indicates that the log messages for the scoped application should be written to both the localhost logs and the syslog table.

In addition, when creating the property for a specific scoped application, the following fields in the system property should 

Suffix: This should be set to the specific property that is to be configured for the scoped application, in this case logging.destination.

Name: When creating a property in a scoped application, this field will usually be auto-populated based on the Suffix value and the current scope the user is in when creating the property.  The name of the property should be the exact same prefix as used for the current scope, followed by a period and then followed by the suffix logging.destination.  In our example scoped application with a name of x_sn_newapp, the name of this property should be entered as x_sn_newapp.logging.destination.

Application: The application field would normally be the Full Name value of the scoped application to which this system property belongs.

Description: This is an optional field which the admin can use to indicate the purpose and usage of the property.

Choices: This field should be set to the two options which can be selected for the property with a comma in between: DB,FILE.

Type: This should be the selection choice list, as selected from the pull down menu.

Value: This should be either the string FILE or the string DB, as described above in the description of this property.

The Ignore Cache and Private checkboxes should both be selected for this system property.

Example logging.destination System Property

Once created (or updated) the setting for the property should then determine the destination of the log file writes for new user logins.

Lacking this property, the default value of db is assumed and thus, if the property is not specified the logging messages for the scoped application is recorded in the log file itself as well as in the syslog table on the instance.

The logging.verbosity System Property


Another property which can be used to configure logging of messages in a scoped application is the logging.verbosity property.  This property can be used to suppress certain levels of logging for that application.  The values allowable for this property are as follows:

  • error - A value of Error indicates that only Error level messages will be recorded in the logs for this scoped application.
  • warn - A value of warn indicates that logging messages of both Error and Warning will be recorded and written to the logs.
  • info - A value of Info indicates that logging levels of Error, Warning and Information will be records and written to the logs.
  • debug - A value of Info indicates that all levels of logging messages will be recorded in the logs for the scoped application.

When creating this property for a scoped application, the following fields in the System Property record should also be filled out as indicated:

Suffix: This should be set to the specific property name that is to be configured for the scoped application, in this case logging.verbosity.

Name: When creating a property in a scoped application, this field will usually be auto-populated based on the Suffix value  specified and the current scope the user is in when creating this property.  The name of the property should be the exact same prefix as that used for the current scope, followed by a period and then followed by the suffix (logging.verbosity).  In our example scoped application with a name of x_sn_newapp, the name of this property should be entered as x_sn_newapp.logging.verbosity.

Application: The application field would normally be the Full Name value of the scoped application to which this system property belongs.

Description: This is an optional field which the admin can use to indicate the purpose and usage of this system property.

Choices: This field should be set to the options which can be selected for the property with a comma in between each allowable setting for the property: debug,info,warn,error.

Type: This should be the selection choice list, as selected from the pull down menu.

Value: This should be one of the strings (error, warn, info, or debug) as described above for the description of this property.

The Ignore Cache and Private checkboxes should both be selected for this system property.

Example of logging.verbosity System Property

The change to the logging level for the selected scoped application should then be reflected in the system logs for new user logins.

If this property is not specified or the Value field is blank for the property, the default value of info will be assumed by the system, thus resulting in the recording of information, error and warning level messages to the logs.

Other Concerns


It should also be noted that if either of these properties is created in the Global Application scope, the property will apply to all messages issued by the system in the Global scope.

An issue which is sometimes encountered or reported is that error messages for a specific application or for the system in general are not being recorded as expected.  In this event, these settings should be checked, as the cause of the issue will often be the current setting for these properties for a specific application scope.

Additional Information


The following URL link to the ServiceNow Developer site provides additional information regarding the logging.destination property:

https://developer.servicenow.com/app.do#!/document/content/app_store_doc_scoped_script_london_r_LogMessageDestination?v=london

The following URL, also from the ServiceNow Developer site provides information regarding these properties as associated with a scoped application:

https://developer.servicenow.com/app.do#!/document/content/app_store_doc_scoped_script_london_r_ScopedApplicationSystemProperties?v=london

Article Information

Last Updated:2018-10-16 10:36:54
Published:2018-10-12