Skip to main content
Version: 1.0

Debug Logs

Ability to stream debug logs from a device over MQTT, websocket or UDP to diagnose problems is supported. Information about your current configuration of this feature can be found through Sys.GetConfig. Log streams are disabled by default. To change the configuration and enable logging, use the RPC method Sys.SetConfig.

Logs over MQTT

When enabled, debug log is published to the topic <shelly-id>/debug/log.

Example:

Example log snippet
shellypro4pm-f008d1d8b8b8 0 1630591789.944 2|mgos_sys_config.c:232   Loading conf3.json
shellypro4pm-f008d1d8b8b8 1 1630591790.208 2|mgos_sys_config.c:232 Loading conf9.json
shellypro4pm-f008d1d8b8b8 2 1630591790.346 2|mgos_sys_config.c:232 Loading conf3.json
shellypro4pm-f008d1d8b8b8 3 1630591790.732 2|mgos_sys_config.c:174 Saved to conf9.json
shellypro4pm-f008d1d8b8b8 4 1630591790.750 2|shelly_notifications:79 NotifyEvent: 'localweb266' (WS_in) -> ok? 1
shellypro4pm-f008d1d8b8b8 5 1630591790.758 2|shelly_notifications:79 NotifyEvent: 'shelly.cloud' (SHC) -> ok? 1
shellypro4pm-f008d1d8b8b8 6 1630591790.768 2|shelly_notifications:79 NotifyEvent: 'shellypro4pm-f008d1d8b8b8/events' (MQTT) -> ok?

Logs over Websocket

note

Prior to version 1.0.0 access to log streams over websocket is not restricted, even when authentication is enabled!

When enabled, device log is streamed to ws://<SHELLY_HOST>/debug/log (for example, ws://10.33.52.133/debug/log). When disabled, logging is stopped and all open websocket debug connections are closed. Up to three websocket debug connections can be opened simultaneously.

The log is streamed as JSON objects that have the following properties:

  • ts: number, unix timestamp (in UTC)
  • level: number, log level. Range of values: 0 -> error, 1 -> warn,2 -> info, 3 -> debug, 4 -> verbose debug
  • data: string, the log message

Example:

{
"ts": 1630322411.725,
"level": 2,
"data": "shelly_switch.cpp:1096 change voltage\n"
}

Logs over UDP

When enabled, device log is streamed to the address (<host>:<port>) specified in the configuration of the System component of your device.

You can observe the streamed log using:

mos console --port udp://host:port

Example:

Example log snippet
[Sep  2 17:28:00.811] shellypro4pm-f008d1d8b8b8 66 366.319 2 2|shelly_switch.cpp:1096  change aenergy
[Sep 2 17:28:00.813] shellypro4pm-f008d1d8b8b8 67 366.327 2 2|shelly_notifications:79 NotifyStatus: 'localweb247' (WS_in) -> ok? 1
[Sep 2 17:28:00.822] shellypro4pm-f008d1d8b8b8 68 366.338 2 2|shelly_notifications:79 NotifyStatus: 'shellypro4pm-f008d1d8b8b8/events' (MQTT) -> ok? 1
[Sep 2 17:28:00.822] shellypro4pm-f008d1d8b8b8 69 366.352 2 2|shelly_switch.cpp:1096 change aenergy
[Sep 2 17:28:00.823] shellypro4pm-f008d1d8b8b8 70 366.361 2 2|shelly_notifications:79 NotifyStatus: 'localweb247' (WS_in) -> ok? 1