Workflow Logging OverviewIssue Workflow Logging Overview Goals Introduction to Workflow LoggingLogging from the EngineLogging from the ActivityWriting customized Log messages in Script Summary The Workflow Engine provides configurable logging options using the Workflow Properties. Log messages indicate their source of the message. A Message log entry comes from either the ENGINE or from within an ACTIVITY. Log entries can be made into the Context Workflow Log using the Log Message Activity, the Log Trace Activity, and directly through JavaScript. As the Workflow logging gets more verbose, the list filter is a quick way to locate messages. ResolutionLogging in ServiceNow Workflow ServiceNow Workflow provides logging in a log exclusive to workflows. It is separate from the System log that is specific to a currently executing Workflow Context. Logging is useful for debugging and tracing progress through a workflow. ServiceNow Workflow is part of the Glide Script Engine and is invoked with the insert, update, delete or cancel of a Glide record. Log entries in the Workflow Log indicate whether they were entered from the Engine or from the Activity. The level of logging present in the Workflow Context is configurable by properties. Add a log message activity The first exercise demonstrates the default logging behavior in the workflow. Return to the Workflow Editor by re-selecting the ServiceNow tab.Click New on the workflow canvas header.Fill out the form as follows.Name K14 Logging Demo. Table: Global. Click the Submit button. Expand the Utilities folder of the Activities Tree.Find the Log Message Activity in the Utilities folder.Hold the mouse down and drag the Activity onto the canvas.Hover the Activity over the transition line until the line turns blue.Release the mouse. The New Activity form displays.Fill out the form as follows.Name: K14 Log Message Message: This is a message in the Log Message Activity. Click the Submit button. Your workflow should look like this: Find the Log Trace Message Activity in the Utilities folder.Hold the mouse down and drag the Activity onto the canvas.Hover the activity over the transition line between Log Message and End until the line turns blue.Release the mouse.Fill out the form as follows:Name K14 Log Trace Message. Click Submit.Your workflow should look like this: Find the Run Script Activity in the Utilities folder.Hold the mouse down and drag the Activity onto the canvas.Hover the activity over the transition line between the Log Trace Message and End Activities until the line turns blue.Release the mouse.Fill out the form as follows:Name: K14 Log Message from inside Run ScriptScript:workflow.debug(‘Logging DEBUG from inside a script’);workflow.info(‘Logging INFO from inside a script’); Click the Submit button.Your workflow should look like this: Click the green Play button in the header of the canvas. Click the Submit button.QUESTION: What does the blue coloring of the activities tell us? Review logging output Return to the main ServiceNow tab. In the Applications Select the All Contexts module in the Workflow. Select the Workflow Execution: K14 Logging Demo context. Select the Workflow Log tab.Notice the Source column: ENGINE is a message that is coming from within the Workflow Engine.ACTIVITY is a message that is coming from the JavaScript within a Workflow Activity. Notice the messages: (1) The first ACTIVITY message is the output of the Log Message Activity.(2) The next three messages are the output of the Trace Message Activity. The Trace Message Activity logs the name assigned to the Activity, the event that the workflow is transitioning on, and the ID of the Workflow Context.(3) The third message is the INFO message written in the Script field of the Run Script activity. QUESTION: What message is missing from this log?The level of verbosity in the Workflow Log is configurable by properties. Workflow > Properties. Check the property Log details of workflow actions. This property sets the level of log messaging.Check Log workflow debug messages. It sets the level of log messaging while debugging is activated.Return to the Workflow Editor and close the tab.Open the K14 Logging Demo workflow. Note that the workflow is Checked out.Re-execute the workflow using the green Play arrow.Return to the main ServiceNow tab.Workflow > All Contexts.Find and select the most recently run K14 Logging Demo workflow.Select the Workflow Log tab.Your list should look like this:NOTE: The Actual number of Workflow Log messages will vary.Notice: The dramatic increase in Workflow Log entries.The mix of Debug and Information messages.How much information is coming from the ENGINE! Search the list for run script logging Do these next steps using the List filter. Select: Go to Message.Type: from Run Script. Click the Search icon (magnifying glass).Your list should look like this:Notice the previously missing Debug message from the Run Script Activity is now in the Workflow Log. NOTE: The Workflow Logging Properties apply to all running Contexts. Use them only when needed for debugging or testing to optimize performance on your instance.