Live logging

Live logging is available in the Tools menu in Developer Workspace and displays a live capture of events from your installed SmartApps and connected devices. Use live logging as a companion tool to learn more about the behaviors of your SmartApps and devices and to help troubleshoot issues.

IMPORTANT

Live logging captures live events while running in the browser and does not retrieve past, historical events.

SmartThings SDK Live logging Layout

Start live logging events

  1. Select your SmartApp type (e.g. Automations, cloud-to-cloud, directly connected).
  2. Filter a particular SmartApp (and/or connected device) from the dropdown menu.
  3. Press “Play”.

Live logging control bar

  • Play button: Play/stop/pause the live capture.
  • Clear button: Clear output.
  • Output save button: Save output to your local file system.

Examples

Live logging can help during the development process by helping you confirm that the expected events are generated.

View events for connected devices

Live logging captures events that relate to your connected devices. The below output shows a DEVICE_EVENT generated when the device is unlocked:

// Live Logging output example

2018.10.17 00:00:00     DEVICE_EVENT

{
 "eventTime": 1539734400000,
 "eventType": "DEVICE_EVENT",
 "deviceEvent": {
   "eventId": "a7777777-aaaa-bbbb-cccc-dddddddddddd",
   "locationId": "b1234567-aaaa-bbbb-cccc-dddddddddddd",
   "deviceId": "c0000000-aaaa-bbbb-cccc-dddddddddddd",
   "componentId": "main",
   "capability": "lock",
   "attribute": "lock",
   "value": "unlocked",
   "valueType": "string",
   "stateChange": true,
   "data": null,
   "subscriptionName": "locationSub"
}

Troubleshoot your SmartApp

Live logging can help you troubleshoot and debug your SmartApps or connected devices, using the error messages included in generated events. Below, note the error payload that is returned when attempting to run your SmartApp.

// Live Logging output example
{"eventType":"EXECUTION_RESULT_EVENT", "error": {"code":"ConstraintViolationError", "message":"The request is malformed", ...,
"details":[{"code":"BodyMalformedError","message":"PARAGRAP is not a valid type","target":"configurationData page sections[0].settings[0]", ...}]}}

Inspecting the message, we see there is a typographical error in the word “PARAGRAPH”.

// Typo example in SmartApp
{
  pageId: '1',
  name: 'configuration page',
  nextPageId: null,
  previousPageId: null,
  complete: true,
  sections: [
    {
      name: 'Sample Endpoint',
      settings: [
        {
           description: 'This is a template for sample endpoint,
           type: 'PARAGRAP',  // TYPO - missing 'H'
        }
      ]
    }
  ]
}

The below example shows an error message returned in live logging when attempting to install the SmartApp.

// Live Logging output example
{"eventType":"INSTALLED_APP_LIFECYCLE_EVENT", "error": {"code":"ConstraintViolationError", "message":"The request is malformed", ...,
"details":[{"code":"UnsupportedPermissionRequestedError","message":"The requested permission is not supported by the backing App's Oauth Client",
"target:"config.app.configEntry.permissionConfig.permission(x:devices:*)","details":[]}]}}

After investigating, you would find that although this SmartApp is using the indicated scope, the scope was not set when first registering the SmartApp in Developer Workspace.

Event types

The following event types are returned from SSE subscriptions and live logging.

Event type Description
DEVICE_EVENT A device event as a result of a subscription the app created.
DEVICE_LIFECYCLE_EVENT A device lifecycle event as the result of a life change to the device.
DEVICE_HEALTH_EVENT A device health event as a result of a change in a device’s health.
DEVICE_COMMANDS_EVENT Only applicable for cloud-to-cloud device integration apps. An event as a result of a device command execution request.
LOCATION_LIFECYCLE_EVENT A location event that results from a location being created, updated, deleted or mode change.
MODE_EVENT A mode event is triggered when the location’s mode is changed.
TIMER_EVENT An timer event as a result of a scheduled app execution.
SCENE_LIFECYCLE_EVENT A scene lifecycle event as a result of a life change to the scene.
SECURITY_ARM_STATE_EVENT A security arm state event as a result of a change in the arm state of a security system.
SECURITY_ARM_FAILURE_EVENT An event generated from a failure to arm properly.
INSTALLED_APP_LIFECYCLE_EVENT An installed app event that results from an installed app being created, updated, deleted.
SMART_APP_EVENT A SmartApp event.
SMART_APP_DASHBOARD_CARD_EVENT A SmartApp dashboard card event.
EXECUTION_RESULT_EVENT An execution result event that results from installed application execution.