Is there a luup extension for capturing incoming information to job_handlers? I want to differentiate and keep track of the different types of luup engine restarts (power outage, saved changes, memory overload, etc.). I was able to find this distinction in LuaUPnP logs, but am not sure how to intercept the information to use it.
JobHandler_LuaUPnP::Reload: reload Critical //press reload button
JobHandler_LuaUPnP::Reload: ModifyUserData Critical //a save was made
Also, I have looked but unsuccessfully been able to find more documentation on jobhandlers so that I might be able to use this information, anyone have suggestions on where I can read more on the types of information passed to these handlers?
I’m afraid not. These messages are printed directly by the LuaUPnP executable straight to the log. The best you can hope for is to match lines in the log file after they’ve happened (which is surprisingly tricky to code).
I am having a bit of a change in heart and really need to get this coded to pinpoint some bugs that I am having. A bit of research on the wikis& boards trying in to figure out how to read the LuaUPnP.log after the fact, but it didn’t get me very far.
I am assuming this is the surprisingly tricky part? Do you maybe have some advice or example code from another project somewhere on how to capture the logs so I can use string methods to read them? This would be helpful in getting me going in the right direction I think.
I can’t point at code, but I can provide advice on strategy.
One suggestion is that you don’t want your log scanner to itself be affected by Luup restarts. Consequently I wouldn’t do this as a plugin, but instead a shell script that you can launch from an SSH session. If you are having the entire Vera reboot you could look into making it run at system startup.
Two is that log rotation is going to mess with you. Every so often, LuaUPnP.log gets closed, erased, and reopened empty. This happens on a schedule known only to the LuaUPnP executable. Any process that scans the log file will have to cope with this, and live with the possibility of missing some lines if the timing gods are against them.
Start with a shell script like this, and see how far it gets you.
[code]#!/bin/sh
while true; do
tail -f /var/log/LuaUPnP.log
done | grep “^JobHandler_LuaUPnP::Reload:” > /tmp/my-interesting-events[/code]
Best Home Automation shopping experience. Shop at Ezlo!