views:

847

answers:

8

I'm writing a software component that displays on-the-fly the content of a certain log file. Think of boosted-up tail -f. It should be a part of a bigger GUI.

I was wondering which GUI componenet should I choose to implement the scrollable textarea which should display the log file output.

Three my main requirements are:

  1. Search - let the user find words in the log output. I'll emphasize that search cannot be implemented by filter. I want to jump to the a cell containing foo in the log file without hiding its neighbors which do not contain foo, unlike filtering.
  2. Copy - it should enable to select and copy lines easily (That's why I ruled out DataGrid based solutions).
  3. Filter - it should enable me to hide certain lines easily.
  4. Colors - it'd be nice to have the ability to use certain colors sometimes (based on filters)

It would also be nice if the component would obey the MVC pattern.

Of course it is possible to implement all of those with regular read-only textarea, but I was wonderring if there's something easier. The only unusual feature here is to filter, after all searchable text area seems to me like a common requirement.

Java GUI solutions might also be accepted (it could be used for a java app as well).

BareTail is similar to what I'm looking for, but unfortunately it's not availible as a component.

+1  A: 

Key concepts for creating such GUI:

  • GlazedLists is your friend
  • So is JTable
  • If your log format is fixed/xml, its even easier.

Do you want something like this. Its not entirely open source but I am at liberty to share some of its properties.

kd304
Elazar Leibovich
Search is just locate, select and jump to that line.
kd304
A: 

The Eclipse UI Framework contains such a console that you can improve with Text search, syntax highlighting and the such. However, I think the minimum RCP plugins that you need would be too much for your needs.

However, if you are already Eclipse based, it would be a good solution.

Mario Ortegón
+1  A: 

To enable precise filtering, I think you should reconsider structuring the lines into "columns", at least under the hood. For an intuitive UI showing these columns seems right to me, too. For the coloring this should not make a difference.

Copying rows from grids should be easy to achieve, as soon as you have some multi-row-selection available, transforming records back to "raw" text-lines in some ToString-method should be much easier than the other way around.

Therefore, I think you should really go with some grid-approach. If it shall be Xceed, infragistics, other vendors or the built-in .NET-datagrid... that's a different question.

Simpzon
A: 

Just use a RichTextBox in .NET/C#

nos
I'll be glad if you'll specify how do you achieve my requirements with those. Copying from a grid doesn't seem trivial to me.
Elazar Leibovich
It's just a text viewer component, you decide what thext you put in there, you can color lines according to the rtf format, it supports copy/paste(like notepad does), you can easily hook into the selection code if you need to only select whole lines in a click, or hook into the copy pasting if you need to.
nos
A: 

I'd suggest a simple grid in .NET or Java

Sorantis
see above comment to @noselasd
Elazar Leibovich
+1  A: 

This is a good WPF starter project I have, it does highlighting, on the fly log file loading and basic search. In the past I found that maintaining a full text index just for log file searching is too expensive.

http://code.google.com/p/videobrowser/source/browse/#svn/trunk/LogViewer

To display the log messages I use a WPF listview, which is completely virtual and supports all of your requirements.

Sam Saffron
1) Searching through the whole text is OK as well, it'd only be a few Megabytes.2) I'll have a look at it. Does it supports filtering and searching and copying out of the box? Or do I have to implement some (ie, hook Ctrl+F to a search box, and have it search in the list, hook Ctrl+C and inspect the selection for copying)Thanks
Elazar Leibovich
A: 

ObjectListView (an open source wrapper around .NET WinForms ListView) does prefix searching and copying out of the box (plus lots of other neat things).

You can easily use a RowFormatter to give specific rows colors.

If you use the virtual list version, you can implement filtering without difficulty too. I've used it to apply filtering to lists of 100,000+ items and the performance is fine (on my mid-range laptop).

Full text searching would have to be implemented specifically. There are hooks for search-by-typing events.

All this is assuming you have some sort of reasonable LogEntry type model object to display. If you only have a series of lines of text, then you are on your own :)

Grammarian
A: 

I've implemented something similar using a JFace TableViewer. This article should give you a decent starting point.

James Van Huis