Pako
First. I really appreicate the assistance. You have already done more that I expected. I would love to help improve it.
I haev attached a copy of the logwatcher Version 1, the test log file I am using and the results of the log
Version one seems to execute everytime I make a change to the log file. THe portion of the log file I covers me adding "test to the log file 3 times. In each case, the script executed but it detected and triggered the error message script all three times when it should not have triggered it at all.
This seem to closest to working they way I would need it to. The problem, as you pointed out in an earlier email, was how to keep track of what has been read and what hasn't.
8:42:32 AM File.BTVerror [u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test']
8:42:32 AM Python Script
8:42:32 AM Python Script
8:42:32 AM BTV.error_occured u"Adding error: '12'"
8:42:32 AM Transmit IR
8:42:32 AM Transmit IR off
8:42:32 AM Timer: Start new or control running timer
8:42:42 AM Timer.BTVon (0, '4/17/2010 8:42:42 AM')
8:42:42 AM Transmit IR on
8:42:42 AM Transmit IR on
8:43:17 AM File.BTVerror [u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test', u'test']
8:43:17 AM Python Script
8:43:17 AM Python Script
8:43:17 AM BTV.error_occured u"Adding error: '12'"
8:43:17 AM Transmit IR
8:43:17 AM Transmit IR off
8:43:17 AM Timer: Start new or control running timer
8:43:27 AM Timer.BTVon (0, '4/17/2010 8:43:27 AM')
8:43:27 AM Transmit IR on
8:43:27 AM Transmit IR on
8:48:52 AM File.BTVerror [u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test', u'test', u'test']
8:48:52 AM Python Script
8:48:52 AM Python Script
8:48:52 AM BTV.error_occured u"Adding error: '12'"
8:48:52 AM Transmit IR
8:48:52 AM Transmit IR off
8:48:52 AM Timer: Start new or control running timer
8:49:02 AM Timer.BTVon (0, '4/17/2010 8:49:02 AM')
8:49:02 AM Transmit IR on
8:49:02 AM Transmit IR on
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
Monitor log file for error
-
ijourneaux
- Experienced User
- Posts: 102
- Joined: Wed Feb 17, 2010 2:20 am
Re: Monitor log file for error
- Attachments
-
- BTV-2010-04-15.log
- (292 Bytes) Downloaded 99 times
-
- LogWatcher-Version_1.xml
- (3.7 KiB) Downloaded 128 times
-
ijourneaux
- Experienced User
- Posts: 102
- Joined: Wed Feb 17, 2010 2:20 am
Re: Monitor log file for error
Here are the results with Log Watcher Version 2.
The script correctly idntified the last log file and it seemed to read it correctly but nothing ever happened. I added "test" to the log file twice and "Adding error: '12'" once and the script was not executed.
8:58:58 AM Autostart
8:58:58 AM Plugin: Directory Watcher
8:58:58 AM Plugin: File Operations
8:58:58 AM Plugin: Timer
8:58:58 AM Main.OnInit
8:58:58 AM After init of EG find the latest log file and starts monitoring
8:58:58 AM Python Script
8:58:58 AM BTV.lastLogFile ('c:\\Temp\\LOG\\BTV-2010-04-15.log',)
8:58:58 AM Start last log file monitoring
8:58:58 AM Python Script
8:59:33 AM File.BTVerror [u"Adding error: '12'", u'test', u'test', u"Adding error: '12'", u'test']
8:59:37 AM File.BTVerror [u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test', u'test', u'test', u"Adding error: '12'", u'test', u'test', u"Adding error: '12'", u'test']
8:59:58 AM File.BTVerror [u'test', u'test', u"Adding error: '12'", u'test', u'test']
9:00:02 AM File.BTVerror [u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test', u'test', u'test', u"Adding error: '12'", u'test', u'test', u"Adding error: '12'", u'test', u'test']
9:00:17 AM File.BTVerror [u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test', u'test', u'test', u"Adding error: '12'", u'test', u'test', u"Adding error: '12'", u'test', u'test', u"Adding error: '12'"]
9:00:18 AM File.BTVerror [u'test', u"Adding error: '12'", u'test', u'test', u"Adding error: '12'"]
I tried restarting EventGhost and loading the LogWatcher Ver 2 script a second time. This time the script refused to execute at all
9:03:37 AM ---> Welcome to EventGhost <---
9:03:37 AM Autostart
9:03:37 AM Plugin: Directory Watcher
9:03:37 AM Plugin: File Operations
9:03:37 AM Plugin: Timer
9:03:37 AM Main.OnInit
9:03:37 AM After init of EG find the latest log file and starts monitoring
9:03:37 AM Python Script
9:03:37 AM BTV.lastLogFile ('c:\\Temp\\LOG\\BTV-2010-04-15.log',)
9:03:37 AM Start last log file monitoring
9:03:37 AM Python Script
9:03:42 AM Autostart
9:03:42 AM Plugin: Directory Watcher
9:03:42 AM Plugin: File Operations
9:03:42 AM Plugin: Timer
9:03:42 AM Main.OnInit
9:03:42 AM After init of EG find the latest log file and starts monitoring
9:03:42 AM Python Script
9:03:42 AM BTV.lastLogFile ('c:\\Temp\\LOG\\BTV-2010-04-15.log',)
9:03:42 AM Start last log file monitoring
9:03:42 AM Python Script
The FileOperations plug in was upgraded to version 0.1.6 which I believe is the correct version of LogWatcher ver 2.
Take Care
The script correctly idntified the last log file and it seemed to read it correctly but nothing ever happened. I added "test" to the log file twice and "Adding error: '12'" once and the script was not executed.
8:58:58 AM Autostart
8:58:58 AM Plugin: Directory Watcher
8:58:58 AM Plugin: File Operations
8:58:58 AM Plugin: Timer
8:58:58 AM Main.OnInit
8:58:58 AM After init of EG find the latest log file and starts monitoring
8:58:58 AM Python Script
8:58:58 AM BTV.lastLogFile ('c:\\Temp\\LOG\\BTV-2010-04-15.log',)
8:58:58 AM Start last log file monitoring
8:58:58 AM Python Script
8:59:33 AM File.BTVerror [u"Adding error: '12'", u'test', u'test', u"Adding error: '12'", u'test']
8:59:37 AM File.BTVerror [u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test', u'test', u'test', u"Adding error: '12'", u'test', u'test', u"Adding error: '12'", u'test']
8:59:58 AM File.BTVerror [u'test', u'test', u"Adding error: '12'", u'test', u'test']
9:00:02 AM File.BTVerror [u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test', u'test', u'test', u"Adding error: '12'", u'test', u'test', u"Adding error: '12'", u'test', u'test']
9:00:17 AM File.BTVerror [u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test6', u'test', u'test', u"Adding error: '12'", u'test', u'test', u'test', u'test', u'test', u"Adding error: '12'", u'test', u'test', u"Adding error: '12'", u'test', u'test', u"Adding error: '12'"]
9:00:18 AM File.BTVerror [u'test', u"Adding error: '12'", u'test', u'test', u"Adding error: '12'"]
I tried restarting EventGhost and loading the LogWatcher Ver 2 script a second time. This time the script refused to execute at all
9:03:37 AM ---> Welcome to EventGhost <---
9:03:37 AM Autostart
9:03:37 AM Plugin: Directory Watcher
9:03:37 AM Plugin: File Operations
9:03:37 AM Plugin: Timer
9:03:37 AM Main.OnInit
9:03:37 AM After init of EG find the latest log file and starts monitoring
9:03:37 AM Python Script
9:03:37 AM BTV.lastLogFile ('c:\\Temp\\LOG\\BTV-2010-04-15.log',)
9:03:37 AM Start last log file monitoring
9:03:37 AM Python Script
9:03:42 AM Autostart
9:03:42 AM Plugin: Directory Watcher
9:03:42 AM Plugin: File Operations
9:03:42 AM Plugin: Timer
9:03:42 AM Main.OnInit
9:03:42 AM After init of EG find the latest log file and starts monitoring
9:03:42 AM Python Script
9:03:42 AM BTV.lastLogFile ('c:\\Temp\\LOG\\BTV-2010-04-15.log',)
9:03:42 AM Start last log file monitoring
9:03:42 AM Python Script
The FileOperations plug in was upgraded to version 0.1.6 which I believe is the correct version of LogWatcher ver 2.
Take Care
- Attachments
-
- LogWatcher-Version_2.xml
- (4.33 KiB) Downloaded 158 times
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: Monitor log file for error
Now I do not have time to look at it in detail, but now I see a problem.
The script remembers always the last read line.
The next time run, then looking this line at new data.
If it is found, all in preceding lines (including identical) are discarded.
Search pattern is searched in other rows.
It is important that testing conducted with more real data.
Line always begins with a timestamp and is therefore unlikely that there will be two completely identical rows.
Pako
The script remembers always the last read line.
The next time run, then looking this line at new data.
If it is found, all in preceding lines (including identical) are discarded.
Search pattern is searched in other rows.
It is important that testing conducted with more real data.
Line always begins with a timestamp and is therefore unlikely that there will be two completely identical rows.
Pako
-
ijourneaux
- Experienced User
- Posts: 102
- Joined: Wed Feb 17, 2010 2:20 am
Re: Monitor log file for error
Thanks Pako. The help is much appreciated. Will try with more realistic log entries. and see what happens.
-
ijourneaux
- Experienced User
- Posts: 102
- Joined: Wed Feb 17, 2010 2:20 am
Re: Monitor log file for error
Pako
I just wanted to let you know that after many delays, I finally got the sample script you created working in my application. The script seems to work great. MY first attempt involved trying to use a IR controlled power switch. I couldn't get the power switch to respond to the IR signals from my IR Blaster. So change of plans, Ented up using an X10 power switch. Once I got the X10 CM15A plugin working, I was off to the races.
Took the time to examine and understand the python code you created as part of the sample. It is amazing what you can do.
I was wondering what would be involved if you needed to react to several different error codes; i.e. If Error 12 or Error 41 then power cycle the device.
Really appreciate the effort.
Ian
I just wanted to let you know that after many delays, I finally got the sample script you created working in my application. The script seems to work great. MY first attempt involved trying to use a IR controlled power switch. I couldn't get the power switch to respond to the IR signals from my IR Blaster. So change of plans, Ented up using an X10 power switch. Once I got the X10 CM15A plugin working, I was off to the races.
Took the time to examine and understand the python code you created as part of the sample. It is amazing what you can do.
I was wondering what would be involved if you needed to react to several different error codes; i.e. If Error 12 or Error 41 then power cycle the device.
Really appreciate the effort.
Ian
Re: Monitor log file for error
I am having issues trying to monitor the same file. The script just stops as if it has unmet criteria.
I am using EG 0.4.1.r1534
I have made a few changes to the script:
1) The path to the log file is different. (There are spaces in the path)
2) The error is different.
I am familiar with EventGhost but not Python scripting.
Please see attached files.
Thanks for the help!
I am using EG 0.4.1.r1534
I have made a few changes to the script:
1) The path to the log file is different. (There are spaces in the path)
2) The error is different.
I am familiar with EventGhost but not Python scripting.
Please see attached files.
Thanks for the help!
- Attachments
-
- LogWatcher-v3.xml
- (4.52 KiB) Downloaded 132 times
-
- BTV-2011-08-05.log
- (3.08 KiB) Downloaded 143 times