Implementing a GUI to view the log using C # (or java)

I am writing a software component that displays the contents of a specific log file on the fly. Think about raising the level of tail -f . It should be part of a larger GUI.

I was wondering which component of the GUI component I should choose to implement a scrollable text field that should display the output of the log file.

My three basic requirements:

  • Search - allows the user to find words in the output log file. We emphasize that the search cannot be implemented using a filter. I want to go to the cell containing foo in the log file without hiding my neighbors that do not contain foo , as opposed to filtering.
  • Copy - this should make it easy to select and copy rows (why I excluded solutions based on DataGrid).
  • Filter - it should allow me to easily hide certain lines.
  • Colors - it would be nice to be able to sometimes use certain colors (based on filters).

It would be nice if the component obeyed the MVC pattern.

Of course, you can implement all those that have a regular read-only text area, but I was wondering if there was anything simpler. The only unusual feature here is filtering, since the entire searchable text area seems to me a general requirement.

Java GUI decisions can also be made (it can also be used for a java application).

BareTail seems to be what I'm looking for, but unfortunately it is not available as a component.

+4
source share
8 answers

ObjectListView (an open source wrapper around .NET WinForms ListView) prefixes search and copy out of the box (plus many other neat things).

You can easily use RowFormatter to give specific row colors.

If you are using a virtual list version, you can also implement filtering. I used it to apply filtering to lists of over 100,000 items, and performance is fine (on my middle-class laptop).

Full-text search must be implemented specifically. There are hooks for searching by type of event.

All of this assumes that you have some kind of sensible model object of type LogEntry to display. If you only have a series of lines of text, then you are on your own :)

0
source

Key concepts for creating such a graphical interface:

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

You want something like this . This is not completely open source, but I can share some of its properties.

+1
source

To enable fine filtering, I think you should reconsider structuring rows in โ€œcolumns,โ€ at least under the hood. For an intuitive user interface showing these columns seems to me correct. For coloring, this should not matter.

Copying lines from grids should be easily achieved, as soon as you have access to several rows of lines, converting records back to raw text strings in some ToString method should be much easier than vice versa.

Therefore, I think that you really should go with some network approach. If it is Xceed, infragistics, other vendors or the built-in .NET datagrid ... what is another question.

+1
source

This is a good WPF starter project that I have, it does highlighting, loading a log file on the fly and basic search. I used to find that maintaining a full text index just to find a log file is too expensive.

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

To display log messages, I use a list of WPF lists that is completely virtual and supports all your requirements.

+1
source

The Eclipse user interface contains a console that you can improve by searching for text, syntax highlighting, etc. However, I think the minimal RCP plugins you need will be too much for your needs.

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

0
source

Just use RichTextBox in .NET / C #

0
source

I would suggest a simple grid in .NET or Java

0
source

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

0
source

All Articles