Log redirector and filter

Questions and comments specific to a particular plugin should go here.
User avatar
Pako
Plugin Developer
Posts: 2274
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Log redirector and filter

Post by Pako » Wed Oct 20, 2010 3:26 pm

I have in one PC installed EventGhost as a "service".
It's not obviously a really service, but EventGhost is started before user logon.
This is done using the Windows Scheduler (option When my computer starts (before a user logs on).
The problem is that in this case is not available EventGhost window and therefore the log.
That's why I made this plugin that allows you to save the log to a text file.
I think this plugin can be used in other situations too.
I made only very short tests, and so I do not know how the plugin will behave after prolonged use.

Pako

EDIT 2015-03-17: added new version 0.1.0
Attachments
__init__.py
Plugin Log redirector and filter - version 0.1.0
- event filtering can be used even for native EventGhost log
- added identifiers INFO, NOTICE and ERROR
- filter string can contain curly brace wildcards {*} and {?}
(31.92 KiB) Downloaded 343 times
__init__.py
Plugin Log redirector - version 0.0.8 (support URL updated)
(25.88 KiB) Downloaded 411 times
__init__.py
Plugin Log redirector - version 0.0.7
Requires EventGhost r1610 or later.
(25.82 KiB) Downloaded 358 times
You know flattr ? You can Image

stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: Log redirector

Post by stottle » Wed Oct 20, 2010 4:41 pm

EG uses a list to store the log messages I believe, with a size of 2000 or 10000 lines (I forget which). Would it be possible to do the same in this case, where the txt file is kept to some line count? What would be really interesting would be to push the logged lines into the UI once the users logs in, too.

Interesting idea, Pako.

Brett

krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Log redirector

Post by krambriw » Wed Oct 20, 2010 6:18 pm

Hi Pako, I used a similar idea to create log files because I wanted to read the log data from remote (also over internet). In my case I wanted them to be easy to view with a browser so I created them with extension .html instead of .txt

Each time you then write a new line to the log file, you can add this string at the end "<br\n>" and it will look ok in the browser

But it depends of course what you want to do with the log data. If you want to parse & extract something, .txt is just fine

Best regards, Walter

User avatar
Pako
Plugin Developer
Posts: 2274
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Log redirector

Post by Pako » Thu Oct 21, 2010 8:09 am

Dear Walter!
krambriw wrote:In my case I wanted them to be easy to view with a browser so I created them with extension .html instead of .txt
I do not understand. All my browsers correctly display the contents of txt files (not ignoring the larger number of space characters in a row - that is, indent).
What are the advantages html extension? I tried it, but it is much worse than the txt format. I would have to insert some formatting tags to the right indent.

BTW: I forgot one very important thing.
Log redirector plugin should be placed as high in the branch Autostart.

Best regards, Pako
You know flattr ? You can Image

miljbee
Experienced User
Posts: 146
Joined: Fri Mar 27, 2009 1:29 pm
Location: Orléans, France

Re: Log redirector

Post by miljbee » Thu Oct 21, 2010 8:52 am

Excellent Pako,

I have always been annoyed by the log system of eg.
My main problem is that I have a high rate of events in my tree, and when I want to check something, I usually don't have the time to see what happens, the log scrolls really to fast.

With your plugin (which I haven't tested yet), I will be able to look at what happens from the text file. It will be far more usable for me.

A nice feature for your plugin would be to implement filters. I have no precise idea of how you could do that, but usually, when you need the log, you don't need what is known to work.

I will try your plugin ASAP.

Thank you !
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.

krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Log redirector

Post by krambriw » Thu Oct 21, 2010 1:55 pm

Dear Pako,
I just remember I once had problems to show .txt files in Internet browsers (the format did not display well and I always had to confirm that I wanted to open the .txt file) This was some years ago and maybe this is not a problem any more with recent browsers

Best regards, Walter

miljbee
Experienced User
Posts: 146
Joined: Fri Mar 27, 2009 1:29 pm
Location: Orléans, France

Re: Log redirector

Post by miljbee » Fri Oct 22, 2010 9:50 am

This is a really great plugin for debugging a very busy tree.

Anyway, I would like to be able to specify the "commit interval" in seconds. Having to wait at least one minute to see what has happened when you are debugging is a bit long.

And as written above, implementing filters would be awesome. Since everything in eg is driven by events, it would be great to filter them (and the macro they trigger).

For exemple, in the conf dialog of the plugin, we could have 2 fields to define filters for exclusion or inclusion.
In these fields we would write event Names.

when logging to a file, your plugin should match the event name defined in the exclusion filters. If it matches, then do nothing until next event. If it doesn't match, write log file until next event.
It's the same for inclusion filter : if it matches an event from the inclusion list, then write log to file until next event.

I had a quick look at your code to see if I could implement this by myself, but haven't understand anything ... I am to bad with python !

Regards,
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.

User avatar
Pako
Plugin Developer
Posts: 2274
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Log redirector

Post by Pako » Sun Oct 31, 2010 12:22 pm

I was some time away from the internet and in the meantime I made some improvements to the plugin.

1) Version 0.0.1
This version has added feature of monitoring the size of the log file.
You can choose the maximum size (max 999 MiB). Once it reached the selected size of the file, file is truncated (of course the latest entries are kept).
The size of the truncated file it is also possible to choose.
__init__.py
Version 0.0.1
(14.74 KiB) Downloaded 452 times
2) Version 0.0.2
This version has added the possibility of filtering events. I do not think that this option will be used by many people.
But because it was not difficult to implement this feature, so I did.
There was also changed the unit of file commit interval. Now that figure is in seconds. So be careful when upgrading from version 0.0.0!
__init__.py
Version 0.0.2
(26.86 KiB) Downloaded 474 times
Pako
Attachments
LogRedirector.jpg
You know flattr ? You can Image

miljbee
Experienced User
Posts: 146
Joined: Fri Mar 27, 2009 1:29 pm
Location: Orléans, France

Re: Log redirector

Post by miljbee » Thu Nov 04, 2010 12:33 pm

Great work Pako !

This plugin will greatly ease my dev/debug sessions.

It's in my tree, and I think it will stay here forever !

Thank You !
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.

krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Log redirector

Post by krambriw » Thu Mar 24, 2011 7:54 am

Dear Pako,
I just tried to add the plugin Version 0.0.2 but I got the following error message (using eg 0.4.0 r1397)
Version 0.0.1 works ok
Best regards, Walter

Code: Select all

08:51:26   Traceback (most recent call last) (1397):
08:51:26     File "C:\Program Files\EventGhost\eg\Classes\TaskletDialog.py", line 59, in ProcessingTask
08:51:26       self.Configure(*args, **kwargs)
08:51:26     File "C:\Program Files\EventGhost\eg\Classes\ConfigDialog.py", line 161, in Configure
08:51:26       treeItem.Configure(*args)
08:51:26     File "C:\Program Files\EventGhost\eg\Classes\ActionItem.py", line 100, in Configure
08:51:26       return self.executable.Configure(*args)
08:51:26     File "C:\Program Files\EventGhost\plugins\LogRedirector\__init__.py", line 728, in Configure
08:51:26       onRadioBox()
08:51:26     File "C:\Program Files\EventGhost\plugins\LogRedirector\__init__.py", line 724, in onRadioBox
08:51:26       onFilterChoice()
08:51:26     File "C:\Program Files\EventGhost\plugins\LogRedirector\__init__.py", line 675, in onFilterChoice
08:51:26       Validation()
08:51:26     File "C:\Program Files\EventGhost\plugins\LogRedirector\__init__.py", line 623, in Validation
08:51:26       flg_1 = len(self.logfile) > 0
08:51:26   TypeError: object of type 'NoneType' has no len()
08:51:26   Traceback (most recent call last) (1397):
08:51:26     File "wx\_core.pyc", line 14618, in <lambda>
08:51:26     File "C:\Program Files\EventGhost\eg\Core.py", line 172, in Notify
08:51:26       listener(value)
08:51:26     File "C:\Program Files\EventGhost\eg\Classes\MainFrame\TreeCtrl.py", line 783, in OnNodeAdded
08:51:26       pos
08:51:26     File "C:\Program Files\EventGhost\eg\Classes\MainFrame\TreeCtrl.py", line 458, in CreateTreeItemAt
08:51:26       return self.CreateTreeItem(node, parentId)
08:51:26     File "C:\Program Files\EventGhost\eg\Classes\MainFrame\TreeCtrl.py", line 446, in CreateTreeItem
08:51:26       node.SetAttributes(self, itemId)
08:51:26     File "C:\Program Files\EventGhost\eg\Classes\PluginItem.py", line 86, in SetAttributes
08:51:26       if self.info.lastException or self.info.initFailed:
08:51:26   AttributeError: 'NoneType' object has no attribute 'lastException'
08:51:26   Traceback (most recent call last) (1397):
08:51:26     File "wx\_core.pyc", line 14618, in <lambda>
08:51:26     File "C:\Program Files\EventGhost\eg\Core.py", line 172, in Notify
08:51:26       listener(value)
08:51:26     File "C:\Program Files\EventGhost\eg\Classes\MainFrame\TreeCtrl.py", line 829, in OnNodeSelected
08:51:26       path = node.GetPath()
08:51:26     File "C:\Program Files\EventGhost\eg\Classes\TreeItem.py", line 354, in GetPath
08:51:26       path.append(parent.childs.index(item))
08:51:26   AttributeError: 'NoneType' object has no attribute 'childs'

User avatar
Pako
Plugin Developer
Posts: 2274
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Log redirector

Post by Pako » Thu Mar 24, 2011 11:48 am

Dear Walter!
Thanks for the warning on a bug. This bug did not show up when you perform an upgrade plugin
(which was already included in the configuration). Therefore, I am about him not knowing.
Now you can download the fixed version 0.0.3.
You'll find it in the first article (on top) of the topic.

Best regards, Pako
You know flattr ? You can Image

User avatar
Livin
Experienced User
Posts: 790
Joined: Wed Oct 08, 2008 4:56 am

Re: Log redirector

Post by Livin » Thu Jun 23, 2011 9:51 pm

Pako,
This is great... I wish I had looked for this a while ago... I could have really used it when testing/troubleshooting from a remote PC.

awesome work!
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system

ijourneaux
Experienced User
Posts: 102
Joined: Wed Feb 17, 2010 2:20 am

Re: Log redirector

Post by ijourneaux » Tue Oct 11, 2011 1:27 am

Pako

I tried installing the Log Redirector plugin (v.6). I can bring up the config page but I amunable to adjust any of the settings. Any thoughts on what I could try.

Take Care

User avatar
Pako
Plugin Developer
Posts: 2274
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Log redirector

Post by Pako » Tue Oct 11, 2011 11:31 am

ijourneaux wrote:I can bring up the config page but I amunable to adjust any of the settings. Any thoughts on what I could try.
Maybe there is some error in the plugin, but more likely is that you are doing something incorrectly.
But how can I know what? Maybe a screenshot would help.

Pako
You know flattr ? You can Image

ijourneaux
Experienced User
Posts: 102
Joined: Wed Feb 17, 2010 2:20 am

Re: Log redirector

Post by ijourneaux » Thu Oct 13, 2011 2:58 am

Sorry Pako. I really didn't give you much to work with. I did figure it out though. At first I didn't understand the logging mode options. I thought the Log EventGhost only meant log eventghost evetns to log file and couldn't figure out why I couldn't specify a file.

Now that I correctly read the options correctly it is clear what you meant

option 1 log eventghost events to eventghost window
option 2 log eventghost events to eventghost window and log file
option 3 log eventghost events to log file

Post Reply