Jump to content

Logging program execution


Andy P

Recommended Posts

Posted

I searched the forums and read all the discussions about program execution and how it is not in the log. You can pull the info on each program with 192.168.x.x:8080/rest/programs and get the last run time and next scheduled time. But that is it. 

So, I decided to try using notifications. In Configuration -> Emails/Notifications -> Customizations I created a notification called Log Program.

Left From blank

Subject: @webpage:@append:/mydir/mylog.txt

Body: ${sys.program.#.address}    ${sys.program.#.name}    ${sys.program.#.status}    ${sys.date} ${sys.time} 

Then I added the notification to the programs I wanted to log such as this, and both the Then and Else if there was one

Breezeway Motion Copy - [ID 009D][Parent 0010]

If
        'YoLink / Motion Breezeway' is switched Motion
 
Then
        Set 'Breezeway' On 80%
        Set 'Breezeway Remote' On 80%
        Send Notification to 'Default' content 'Log Program'
 
The result I retrieve using 192.168.x.x:8443/FILES/USER/WEB/mydir/mylog.txt looks as follows:

program[109] Breezeway Motion True 2025/01/23 02:23:17 PM
program[17] Mud or Hall Motion True 2025/01/23 02:23:20 PM
program[70] Side Door Opens True 2025/01/23 02:23:20 PM
program[17] Mud or Hall Motion False 2025/01/23 02:23:22 PM
program[19] Mudroom Motion End True 2025/01/23 02:24:20 PM
program[110] Breezeway Motion Off Dim True 2025/01/23 02:24:23 PM
program[17] Mud or Hall Motion True 2025/01/23 02:24:29 PM
program[17] Mud or Hall Motion True 2025/01/23 02:24:29 PM
program[51] Hallway Motion End True 2025/01/23 02:25:08 PM
program[110] Breezeway Motion Off Dim True 2025/01/23 02:26:01 PM
program[148] Hallway Motion Backstop True 2025/01/23 02:29:30 PM
program[110] Breezeway Motion Off Dim True 2025/01/23 02:36:01 PM

 

So now I have a nice log of program execution which I can parse and add to my timeline. Anyone else doing this? Is there a better way?

Andy

Posted
37 minutes ago, Andy P said:

Anyone else doing this?

Not me. I guess my question is why is this necessary (why are you doing this)? My outlook on notifications is more for if something doesn't happen that results in an urgent situation (like a water leak or CO sensor alarm). My thought is if I get notifications all the time that I (personally) would tend to disregard the notifications and therefore potentially miss an urgent alert. 

I don't worry when lights turn on (or off). I just care if there is really an urgent situation that I should be notified about that would alarm me and mean I should look into the situation. 

Posted

Well I can see this being useful when implementing some new functionality and you want to monitor it for a while to make sure it's working as planned. Logging security events might also be a useful application.

Posted

As Guy says, it is helpful when you have multiple programs interacting with one another to make sure they are executing in the sequence expected. For example, the breezeway light has four different scenarios depending on the time of day. The program that is supposed to run gets enabled by schedule and the others disabled. If there is motion, it also depends on the time as to which program runs. So this helps me sort out that everything is happening the way I want and expect. I can also see when the Then branch gets triggered and the Else branch.

But these are not Notifications in the sense that they notify you. They use the notification function to create a log entry only. No email, no push notification. In that sense, it is exactly the same as every device making a log entry when they turn on/off/dim.

  • Like 1
Posted

I make *extensive* use of this capability. I don't know how people troubleshoot anything more than simple problems with just the log and error log. (Full disclosure: I have over 1300 programs)

I just wish I didn't have to click every small '+' sign to get to the folder where the files are each time I go to the web server tab. I also wish there was a better folder view with last changed date/time, file size, and files sortable by those various columns.

Be aware that the data is NOT backed up as part of the backup function. You need to go pull the files manually and it's a bit of a process because they are in a folder with restricted access.

 

image.png.2d88a350d0c094ee241ea1f88d771087.png

Posted

Oh, interesting, I didn't think about having a separate log file for each program. I figured it was easier to just put them all in one log file and have the first token be the program identifier.

I would also vote for having the file manager open to the last position I was at to save all that clicking.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...