运行日志

设备任务的功能例程运行后,功能的例程运行后,您可以在设备端和物联网平台查看日志信息

前提条件

已配置C Link SDK的设备任务的功能例程,已配置C Link SDK的使用示例

设备端日志

您可以在设备端查看运行结果。

  • 连接日志:

    [1626941694.977][LK-0313] MQTT user calls aiot_mqtt_connect api, connect
    [1626941694.977][LK-0317] LightSwitch&a1wP******
    [1626941694.977][LK-0318] 9E2560C2D1F353A6908A5F7156A216101BA0E05DE3E447724D9F0DEEA6******
    core_sysdep_network_establish host iot-06******.mqtt.iothub.aliyuncs.com port 1883, type 0
    establish tcp connection with server(host='iot-06******.mqtt.iothub.aliyuncs.com', port=[1883])
    success to establish tcp, fd=3
    local port: 42304
    [1626941695.066][LK-1000] establish mbedtls connection with server(host='iot-06******.mqtt.iothub.aliyuncs.com', port=[1883])
    [1626941695.133][LK-1000] success to establish mbedtls connection, (cost 44947 bytes in total, max used 47859 bytes)
    [1626941695.133][LK-0319] a1wP******.LightSwitch|timestamp=2524608000000,_ss=1,_v=sdk-c-4.1.0,securemode=2,signmethod=hmacsha256,ext=3,_conn=tls_9a|
    [1626941695.200][LK-0313] MQTT connect success in 227 ms
    AIOT_MQTTEVT_CONNECT
  • 接收设备任务通知日志:

    1. 如果设备在线,从物联网平台下发消息后,设备端收到的日志消息如下:

      [1626941940.144][LK-0309] pub: /sys/a1wP******/LightSwitch/thing/job/notify
      [LK-030A] < 7B 22 69 64 22 3A 22 32  30 38 33 36 39 35 37 39 | {"id":"208369579
      [LK-030A] < 35 22 2C 22 70 61 72 61  6D 73 22 3A 7B 22 74 61 | 5","params":{"ta
      [LK-030A] < 73 6B 22 3A 7B 22 6A 6F  62 44 6F 63 75 6D 65 6E | sk":{"jobDocumen
      [LK-030A] < 74 22 3A 7B 22 6B 65 79  22 3A 22 76 61 6C 75 65 | t":{"key":"value
      [LK-030A] < 22 7D 2C 22 6A 6F 62 46  69 6C 65 22 3A 7B 22 66 | "},"jobFile":{"f
      [LK-030A] < 69 6C 65 4B 65 79 22 3A  22 31 32 36 46 39 39 34 | ileKey":"126F994
      [LK-030A] < 43 46 30 38 30 34 35 39  39 38 38 31 35 33 36 34 | CF08045998815364
      [LK-030A] < 32 39 32 45 45 35 30 30  43 2F E9 98 BF E9 87 8C | 292******/......
      [LK-030A] < E5 B7 AE E5 88 86 E5 B7  A5 E5 85 B7 2E 7A 69 70 | .............zip
      [LK-030A] < 22 2C 22 66 69 6C 65 55  72 6C 22 3A 22 68 74 74 | ","fileUrl":"htt
      [LK-030A] < 70 73 3A 2F 2F 69 6F 74  78 2D 74 68 69 6E 67 2D | ps://iotx-thing-
      [LK-030A] < 73 63 68 65 64 75 6C 65  72 2D 6A 6F 62 2D 66 69 | scheduler-job-fi
      [LK-030A] < 6C 65 2E 6F 73 73 2D 63  6E 2D 73 68 61 6E 67 68 | le.oss-cn-shangh
      [LK-030A] < 61 69 2E 61 6C 69 79 75  6E 63 73 2E 63 6F 6D 2F | ai.aliyuncs.com/
      [LK-030A] < 31 32 36 46 39 39 34 43  46 30 38 30 34 35 39 39 | 126F994CF0804599
      [LK-030A] < 38 38 31 35 33 36 34 32  39 32 45 45 35 30 30 43 | 8815364292EE500C
      [LK-030A] < 2F 25 45 39 25 39 38 25  42 46 25 45 39 25 38 37 | /%E9%98%BF%E9%87
      [LK-030A] < 25 38 43 25 45 35 25 42  37 25 41 45 25 45 35 25 | %8C%E5%B7%AE%E5%
      [LK-030A] < 38 38 25 38 36 25 45 35  25 42 37 25 41 35 25 45 | 88%86%E5%B7%A5%E
      [LK-030A] < 35 25 38 35 25 42 37 2E  7A 69 70 3F 45 78 70 69 | 5******.zip?Expi
      [LK-030A] < 72 65 73 3D 31 36 32 36  39 34 35 35 34 30 26 4F | res=1626945540&O
      [LK-030A] < 53 53 41 63 63 65 73 73  4B 65 79 49 64 3D 4C 54 | SSAccessKeyId=LT
      [LK-030A] < 41 49 4D 6F 6A 37 47 49  67 6C 6A 7A 50 72 26 53 | AIMoj7GI******&
      [LK-030A] < 69 67 6E 61 74 75 72 65  3D 69 4B 6F 63 4B 41 54 | Signature=iKocKAT
      [LK-030A] < 43 50 38 54 30 47 70 6F  67 66 34 57 77 61 44 59 | CP8T0Gpogf4WwaDY
      [LK-030A] < 25 32 42 25 32 46 4F 4D  25 33 44 22 2C 22 73 69 | %2B%2******","si
      [LK-030A] < 67 6E 22 3A 22 37 32 30  37 63 35 32 64 64 33 31 | gn":"7207c52dd31
      [LK-030A] < 34 64 30 65 66 66 37 33  33 30 30 39 64 64 36 63 | 4d0eff733009dd6c
      [LK-030A] < 35 66 63 61 39 22 2C 22  73 69 67 6E 4D 65 74 68 | 5fca9","signMeth
      [LK-030A] < 6F 64 22 3A 22 4D 64 35  22 7D 2C 22 74 61 73 6B | od":"Md5"},"task
      [LK-030A] < 49 64 22 3A 22 39 30 65  65 64 39 39 36 66 33 62 | Id":"90eed996f3b
      [LK-030A] < 33 34 62 30 38 38 63 62  31 32 64 38 36 33 38 34 | 34b088cb12d86384
      [LK-030A] < 63 65 37 66 36 22 2C 22  73 74 61 74 75 73 22 3A | *****","status":
      [LK-030A] < 22 53 45 4E 54 22 7D 7D  2C 22 76 65 72 73 69 6F | "SENT"}},"versio
      [LK-030A] < 6E 22 3A 22 31 2E 30 2E  30 22 7D                | n":"1.0.0"}
      [1626941940.144][LK-0B03] task recv notify
      revice task notify, task_id:[90eed996f3b34b088cb12d86384*****],status:[1],job_document[{"key":"value"}],document_file_url:[https://iotx-thing-scheduler-job-file.oss-cn-shanghai.aliyuncs.com/126F994CF08045998815364292EE500C/%E9%98%BF%E9%87%8C%E5%B7%AE%E5%88%86%E5%B7%A5%E5%85%B7.zip?Expires=1626945540&OSSAccessKeyId=LTAIMoj7GI******&Signature=iKocKATCP8T0Gpogf4WwaDY%2B%2******],            sign_method:[Md5],sign[7207c52dd314d0eff733009dd6c5fca9]
    2. 消息接收后,返回如下应答报文:

      [1626941940.144][LK-0309] pub: /sys/a1wP******/LightSwitch/thing/job/notify_reply
      [LK-030A] > 7B 22 69 64 22 3A 22 32  30 38 33 36 39 35 37 39 | {"id":"208369579
      [LK-030A] > 35 22 2C 22 63 6F 64 65  22 3A 32 30 30 2C 22 64 | 5","code":200,"d
      [LK-030A] > 61 74 61 22 3A 7B 7D 7D                          | ata":{}}
    3. 任务作业执行后,向物联网平台上报作业状态。

      [1626941940.144][LK-0309] pub: /sys/a1wP******/LightSwitch/thing/job/update
      [LK-030A] > 7B 22 69 64 22 3A 22 31  22 2C 22 76 65 72 73 69 | {"id":"1","versi
      [LK-030A] > 6F 6E 22 3A 22 31 2E 30  2E 30 22 2C 22 70 61 72 | on":"1.0.0","par
      [LK-030A] > 61 6D 73 22 3A 7B 22 74  61 73 6B 49 64 22 3A 22 | ams":{"taskId":"
      [LK-030A] > 39 30 65 65 64 39 39 36  66 33 62 33 34 62 30 38 | 90eed996f3b34b08
      [LK-030A] > 38 63 62 31 32 64 38 36  33 38 34 63 65 37 66 36 | 8cb12d86384*****
      [LK-030A] > 22 2C 22 73 74 61 74 75  73 22 3A 22 49 4E 5F 50 | ","status":"IN_P
      [LK-030A] > 52 4F 47 52 45 53 53 22  2C 22 70 72 6F 67 72 65 | ROGRESS","progre
      [LK-030A] > 73 73 22 3A 30 7D 7D                             | ss":0}}
      [
    4. 物联网接收作业状态消息后,返回如下应答报文。

      1626941940.255][LK-0309] pub: /sys/a1wP******/LightSwitch/thing/job/update_reply
      [LK-030A] < 7B 22 63 6F 64 65 22 3A  32 30 30 2C 22 64 61 74 | {"code":200,"dat
      [LK-030A] < 61 22 3A 7B 22 74 61 73  6B 49 64 22 3A 22 39 30 | a":{"taskId":"90
      [LK-030A] < 65 65 64 39 39 36 66 33  62 33 34 62 30 38 38 63 | eed996f3b34b088c
      [LK-030A] < 62 31 32 64 38 36 33 38  34 63 65 37 66 36 22 7D | b12d86384*****"}
      [LK-030A] < 2C 22 69 64 22 3A 22 31  22 2C 22 6D 65 74 68 6F | ,"id":"1","metho
      [LK-030A] < 64 22 3A 22 74 68 69 6E  67 2E 6A 6F 62 2E 75 70 | d":"thing.job.up
      [LK-030A] < 64 61 74 65 22 2C 22 76  65 72 73 69 6F 6E 22 3A | date","version":
      [LK-030A] < 22 31 2E 30 22 7D                                | "1.0"}
      revice task update reply, code:[200]
      revice task update reply, task_id:[90eed996f3b34b088cb12d86384*****]
  • 设备主动获取设备任务日志:

    1. 设备上线后,向物联网平台发起获取设备任务请求。

      [1626949668.599][LK-0309] pub: /sys/a1wP******/LightSwitch/thing/job/get
      [LK-030A] > 7B 22 69 64 22 3A 22 31  22 2C 22 76 65 72 73 69 | {"id":"1","versi
      [LK-030A] > 6F 6E 22 3A 22 31 2E 30  2E 30 22 2C 22 70 61 72 | on":"1.0.0","par
      [LK-030A] > 61 6D 73 22 3A 7B 22 74  61 73 6B 49 64 22 3A 22 | ams":{"taskId":"
      [LK-030A] > 24 6E 65 78 74 22 7D 7D                          | $next"}}
    2. 物联网平台接收请求后,返回应答报文。

      [1626949668.799][LK-0309] pub: /sys/a1wP******/LightSwitch/thing/job/get_reply
      [LK-030A] < 7B 22 63 6F 64 65 22 3A  32 30 30 2C 22 64 61 74 | {"code":200,"dat
      [LK-030A] < 61 22 3A 7B 22 74 61 73  6B 22 3A 7B 22 6A 6F 62 | a":{"task":{"job
      [LK-030A] < 44 6F 63 75 6D 65 6E 74  22 3A 7B 22 6B 65 79 22 | Document":{"key"
      [LK-030A] < 3A 22 76 61 6C 75 65 22  7D 2C 22 6A 6F 62 46 69 | :"value"},"jobFi
      [LK-030A] < 6C 65 22 3A 7B 22 66 69  6C 65 55 72 6C 22 3A 22 | le":{"fileUrl":"
      [LK-030A] < 68 74 74 70 73 3A 2F 2F  69 6F 74 78 2D 74 68 69 | https://iotx-thi
      [LK-030A] < 6E 67 2D 73 63 68 65 64  75 6C 65 72 2D 6A 6F 62 | ng-scheduler-job
      [LK-030A] < 2D 66 69 6C 65 2E 6F 73  73 2D 63 6E 2D 73 68 61 | -file.oss-cn-sha
      [LK-030A] < 6E 67 68 61 69 2E 61 6C  69 79 75 6E 63 73 2E 63 | nghai.aliyuncs.c
      [LK-030A] < 6F 6D 2F 31 32 36 46 39  39 34 43 46 30 38 30 34 | om/126F994CF0804
      [LK-030A] < 35 39 39 38 38 31 35 33  36 34 32 39 32 45 45 35 | 5998815364292EE5
      [LK-030A] < 30 30 43 2F 30 36 30 34  31 38 31 31 30 32 37 39 | 00C/060418110279
      [LK-030A] < 5F 30 4D 51 54 54 25 45  36 25 38 45 25 41 35 25 | _0MQTT%E6%8E%A5%
      [LK-030A] < 45 35 25 38 35 25 41 35  25 45 36 25 42 35 25 38 | E5%85%A5%E6%B5%8
      [LK-030A] < 31 25 45 37 25 41 38 25  38 42 25 45 35 25 39 42 | 1%E7%A8%8B%E5***
      [LK-030A] < 25 42 45 2E 7A 69 70 3F  45 78 70 69 72 65 73 3D | ***.zip?Expires=
      [LK-030A] < 31 36 32 36 39 35 33 32  36 38 26 4F 53 53 41 63 | 1626953268&OSSAc
      [LK-030A] < 63 65 73 73 4B 65 79 49  64 3D 4C 54 41 49 4D 6F | cessKeyId=LTAIMo
      [LK-030A] < 6A 37 47 49 67 6C 6A 7A  50 72 26 53 69 67 6E 61 | j7GI******&Signature
      [LK-030A] < 74 75 72 65 3D 73 64 25  32 42 50 37 50 43 4B 41 | =sd%2BP7PCKA
      [LK-030A] < 73 77 4E 4D 33 4D 25 32  46 4B 72 7A 70 57 66 4D | swNM3M%2FKrzpWfM
      [LK-030A] < 41 6F 72 63 25 33 44 22  2C 22 73 69 67 6E 22 3A | A******","sign":
      [LK-030A] < 22 62 36 63 61 64 31 66  65 62 66 62 64 63 66 38 | "b6cad1febfbdcf8
      [LK-030A] < 65 31 38 64 66 38 33 34  35 31 34 37 64 31 34 33 | e18df834514*****
      [LK-030A] < 62 22 2C 22 73 69 67 6E  4D 65 74 68 6F 64 22 3A | b","signMethod":
      [LK-030A] < 22 4D 64 35 22 7D 2C 22  74 61 73 6B 49 64 22 3A | "Md5"},"taskId":
      [LK-030A] < 22 37 65 66 65 63 66 33  65 32 33 64 34 34 30 66 | "7efecf3e23d440f
      [LK-030A] < 36 62 32 34 31 36 33 62  30 38 65 36 32 32 32 39 | 6b24163b08e*****
      [LK-030A] < 34 22 2C 22 73 74 61 74  75 73 22 3A 22 49 4E 5F | *","status":"IN_
      [LK-030A] < 50 52 4F 47 52 45 53 53  22 7D 2C 22 74 61 73 6B | PROGRESS"},"task
      [LK-030A] < 49 64 22 3A 22 24 6E 65  78 74 22 7D 2C 22 69 64 | Id":"$next"},"id
      [LK-030A] < 22 3A 22 31 22 2C 22 6D  65 74 68 6F 64 22 3A 22 | ":"1","method":"
      [LK-030A] < 74 68 69 6E 67 2E 6A 6F  62 2E 67 65 74 22 2C 22 | thing.job.get","
      [LK-030A] < 76 65 72 73 69 6F 6E 22  3A 22 31 2E 30 22 7D    | version":"1.0"}
      revice task get detail, code:[200]
      revice task get detail reply, task_id:[7efecf3e23d440f6b24163b08e622294],status:[2]
      job_document[{"key":"value"}],document_file_url:[https://iotx-thing-scheduler-job-file.oss-cn-shanghai.aliyuncs.com/126F994CF08045998815364292EE500C/060418110279_0MQTT%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B%E5%9B%BE.zip?Expires=1626953268&OSSAccessKeyId=LTAIMoj7GI******&Signature=sd%2BP7PCKAswNM3M%2FKrzpWfMA******], sign_method:[Md5],sign[b6cad1febfbdcf8e18df834514*****b]
                                  
    3. 任务作业执行后,向物联网平台上报作业状态。

      [1626949668.799][LK-0309] pub: /sys/a1wP******/LightSwitch/thing/job/update
      [LK-030A] > 7B 22 69 64 22 3A 22 32  22 2C 22 76 65 72 73 69 | {"id":"2","versi
      [LK-030A] > 6F 6E 22 3A 22 31 2E 30  2E 30 22 2C 22 70 61 72 | on":"1.0.0","par
      [LK-030A] > 61 6D 73 22 3A 7B 22 74  61 73 6B 49 64 22 3A 22 | ams":{"taskId":"
      [LK-030A] > 37 65 66 65 63 66 33 65  32 33 64 34 34 30 66 36 | 7efecf3e23d440f6
      [LK-030A] > 62 32 34 31 36 33 62 30  38 65 36 32 32 32 39 34 | b24163b08e******
      [LK-030A] > 22 2C 22 73 74 61 74 75  73 22 3A 22 49 4E 5F 50 | ","status":"IN_P
      [LK-030A] > 52 4F 47 52 45 53 53 22  2C 22 70 72 6F 67 72 65 | ROGRESS","progre
      [LK-030A] > 73 73 22 3A 38 38 7D 7D                          | ss":88}}
                                  
    4. 物联网接收作业状态消息后,返回如下应答报文。

      [1626949668.855][LK-0309] pub: /sys/a1wP******/LightSwitch/thing/job/update_reply
      [LK-030A] < 7B 22 63 6F 64 65 22 3A  32 30 30 2C 22 64 61 74 | {"code":200,"dat
      [LK-030A] < 61 22 3A 7B 22 74 61 73  6B 49 64 22 3A 22 37 65 | a":{"taskId":"7e
      [LK-030A] < 66 65 63 66 33 65 32 33  64 34 34 30 66 36 62 32 | fecf3e23d440f6b2
      [LK-030A] < 34 31 36 33 62 30 38 65  36 32 32 32 39 34 22 7D | 4163b08e******"}
      [LK-030A] < 2C 22 69 64 22 3A 22 32  22 2C 22 6D 65 74 68 6F | ,"id":"2","metho
      [LK-030A] < 64 22 3A 22 74 68 69 6E  67 2E 6A 6F 62 2E 75 70 | d":"thing.job.up
      [LK-030A] < 64 61 74 65 22 2C 22 76  65 72 73 69 6F 6E 22 3A | date","version":
      [LK-030A] < 22 31 2E 30 22 7D                                | "1.0"}
      revice task update reply, code:[200]
      revice task update reply, task_id:[7efecf3e23d440f6b24163b08e******]

物联网平台日志

您可以在物联网平台控制台查看设备的状态和运行日志。

  • 在线状态:

    在左侧导航栏,选择设备管理设备,找到设备,查看设备状态。设备状态显示为在线,则表示设备与物联网平台成功连接。查看设备状态

  • 设备任务执行情况:

    在左侧导航栏,选择设备管理任务,在任务列表,查看设备任务的执行情况。任务情况

  • 运行日志:

    在左侧导航栏,选择监控运维日志服务,选择产品后,查看设备上线、订阅Topic和上报消息的日志。

    设备任务日志