New Docs on Logging

(Jim Anderson) #1

Just a quick note to let everyone know that we’ve added a docs page for logging in SmartApps or Device Types!

Hat tip to @unixbeast, who wrote this page!

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

Very helpful addition to the docs… thanks! – Especially the examples, like try...catch.

One question / suggestion though… The table describing the suggested (?) use of the various Logging Levels is helpful, but I wonder if the standard could be more comprehensive.

For example, the documentation goes on to say that log trace messages could be coming and intermingled from both our code as well as “from the SmartApp framework”.

Perhaps if messages from the “framework” had their own tag “log.framework()” (?) … then this intermingling would be less confusing.

Alternatively, as a suggestion, I use a “cover method” for log.*() which results in longer messages but they are each tagged with the name (instance label name and app name) of the SmartApp.

This is particularly helpful when viewing multiple trace outputs from various concurrent sources in on the “Live Logging” screen.

private def myInfo(text) { myLogFormat(text)
private def myLogFormat(text) {
    return "\"${app.label}\".(\"${}\"): ${text}"

(Jeff May) #3

Just want to confirm that the logging is only valid if you are running the code in the IDE Right ?

(Jim Anderson) #4

Logging happens regardless of executing in the IDE or installed via the mobile app.

The logged messages are viewable in the IDE via the Live Logging view, or in the console window of the simulator if executing in the IDE.

(Ash ( / Ashutosh Jaiswal) #5

@Jim - Once ST migrates to hubV2 will the logging be visible on the IDE for a smart app, even if the app runs locally on the Hub? or will it only be visible for apps that run on the cloud?