Notifications

2362 views

Description

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.

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.

Resolution

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.

 

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

Suffix: logging.destination
(This holds the property name that is to be configured for the scoped application)

Name: This will automatically populate after suffix is filled out (scope_name.logging.destination)
Example" If the scoped app name is x_sn_newapp, then it would be x_sn_newapp.logging.destination.

Application: The will auto populate with the name of the scoped app.

Description: This is an optional field which is used to hold the purpose and usage of this system property.

Choices: db, file
(This field should hold the options which can be selected for the property with a comma in between each allowable setting for the property)

Type: choice list (as selected from the pull down menu)

Value: This should be one of the strings (db, file) as described above.

The Ignore Cache and Private checkboxes should both be selected for this 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

The Scoped Logging API provides four levels of verbosity. In order from least verbose to most, they are:

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 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.

 

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

Suffix: logging.verbosity
(This holds the property name that is to be configured for the scoped application)

Name: This will automatically populate after suffix is filled out (scope_name.logging.verbosity)
Example" If the scoped app name is x_sn_newapp, then it would be x_sn_newapp.logging.verbosity.

Application: The will auto populate with the name of the scoped app.

Description: This is an optional field which is used to hold the purpose and usage of this system property.

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

Type: 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.

The Ignore Cache and Private checkboxes should both be selected for this 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.

 

Additional Information

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.

Article Information

Last Updated:2020-04-21 11:23:27
Published:2020-04-21