Click here to Skip to main content
Click here to Skip to main content

A real time log file viewer

By , 17 May 2004
 

ABLogFile Screen Shot

Introduction

ABLogFile is a very simple and easy to use real time log file viewer. All that is required is to open a text based log file, this program will check for any changes to the file and automatically display them on the screen. The new changes are displayed in a bright color and then fade to the normal text color. It also automatically scrolls to the newest line. ABLogFile supports a very basic find function.

Background

This program was thought up in the early hours of the night a couple of weeks ago. I was doing some work, a program that updated a file every couple of seconds. My problem was, if I wanted to see the changes, I had to keep reopening the file, thus ABLogFile was thought of.

Points of Interest

The hardest part of the project was how to organize the data in memory, so that it is easy to add new data, keep track of the changes, and quick to display the data. What I ended up doing after a number of sleepless nights of coding, was to store the entire log file in memory, create an array of pointers that point to the starting position of each line, and another array of sections which keep track of the changes to the log file. Another tricky bit was to work out what the line delimiter was in the file, the way that I ended up writing it was to search for a number of different delimiters, this part will definitely be redesigned shortly. Apart from the above mentioned, it was pretty straight forward.

Limitations

Of course, there are some limitations:

  • The log file is currently stored in memory, therefore there may be a problem viewing very large files.
  • With the way that the auto delimiter works, if the second line is blank then the file will not be displayed properly.
  • This program will only keep track of data newly appended to the file, it will not work with data getting changed in the file.

Acknowledgements

  • Tabbed MDI view Copyright © by Dundas Software.

History

I believe this project to be of great benefit, I will be willing to add features as people suggest them. This program currently does what was originally required by myself. So, please let me know of any features required.

  • V 1.0.0.1 2004-05-13
    • First public release of binary and source code.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

amleth
Software Developer (Senior)
Australia Australia
Member
Started programming many many years ago, now a full time C++ developer writing medical software. I have also been known to dabble in electronics. Currently looking to go back to university to study electronic engineering.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralNice try but... :-)memberPeter Hendrix25 May '04 - 23:26 
A typical logfileviewer will also be used to view tracefiles and so on. Trace and logfiles tend to be very large, especially when you are trying to search for problems that occur only once in a while.
 
In my (humble) opinion, this logfileviewer lacks functionallity at several places:
- It does not run in 'idle' time, therefore it will interfere with the running processes on a system.
- It cannot cope with very large files, 500 Mb and higher. I tried it with a 900 Mb file and had to reboot my entire system Smile | :) . The reason for this is that it reads the entire file in memory and starts reading at the beginning of the file.
- It lacks filtering.
 
I have written a logfileviewer that displays the end of a file instantly (regardless of the size of the file (up to 4 Gb)) and immediately starts tracking any changes in the file. It will load the rest of the file in a different thread (in the background) without interfering with the userinterface.
It also saves a huge ammount of memory since I only store the locations of the 'endline' characters in memory (Array). This prevents running out of memory.
 
Unfortunatly I cannot give away the source since it is property of my company. What I can do is help you out with some of the problems we encountered and give away some codesnippets (and the concept) if you like.
 
Don't misunderstand me, I am not critisizing your code, just helping you to improve it. Smile | :)
 
Best regards,
Peter.
GeneralRe: Nice try but... :-)memberamleth26 May '04 - 1:02 
I value your Humble Opinion. Smile | :)
 
I have made changes already with regards to the Idle time, I was previously using Timers, i now use Window notifications for checking when a file changes, but the artical hasn't been updated yet.
 
I originally wrote it for my own use, and i only had small log files to open < 2Mb. I've been palnning to make some changes to the way that the log file gets read. I was going to open it in chunks, thus only requiring 100kb or so of memory.
 
I don't get waht you mean by filtering,Confused | :confused: do you mean hiding certain lines if they start with certain characters, or certain lines if the contain certain characters? If this is useful i can add it without any problems.
 
I understand about your source code, I have a number of things like that.
 
Please let me know of any other suggestions.
 
Amleth Ojalen
 
ABLogFile - a realtime log viewer, a work in progress
ABBaseCalc - a simple base converter
ABHotKeys - you don't know the functionality your missing out on till you use it.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 18 May 2004
Article Copyright 2004 by amleth
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid