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   
QuestionHow to use it ...?memberNusha2415 Jul '05 - 20:41 
Hi Amlet/Thanks for ur nice solution for viewing log files/
I need to use it in my dialog-based project , how can i use ur classes in my project/
Thanks in advanced
AnswerRe: How to use it ...?memberamleth15 Jul '05 - 21:00 
Nusha24,
 

ABLogfile has been designed as a complete project, i don't think it possible to split it up into components that can be used in other projectsFrown | :( It is also designed around the Doc/View arciteture and it would need quite a bit of rewriting to use it in a Dialog based window.
 
There are some newer versions available on my website http://www.amleth.com[^], you are welcome to include ABLogFile with your project distribution if you wish.
 
Please let me know if i can be of any other assistance.
 
Regards
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.
GeneralNew Version Availablememberamleth1 Jul '04 - 18:22 
A new version is available at the following link ABLogFile
I have called it a beta version as so much of the orgininal code has changed, although it hase been tested extensivily
 
I will update the article shortly.
 


 
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.
GeneralUnable to load file > 1MB thru mapped drivememberHilary Wong27 May '04 - 18:00 
Hi,
 
Just tested your latest version. This version does not allow loading of file with size greater than 1mb unless the file resides in the local machine.
 
I've tried two methods in accessing the remote file:
1) mapped drive
2) directly specify the network path
 
Both methods will cause file loading to hang regardless of whether Poll File or Windows Notification is used for File Change Check.
 

Regards,
Hilary

GeneralRe: Unable to load file > 1MB thru mapped drivememberamleth27 May '04 - 18:16 
I'm in the process of completely re-writing this project.
It should be finished in the next couple of days.
 
I'll let you know when it is done.
 
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.
GeneralA nice, freeware alternative: baretailmemberdtr227 May '04 - 1:51 
http://www.baremetalsoft.com/baretail/
 
Also, it doesn't have the limitation of size in-memory...
What is missing (in both viewers) is find/replace.
 
BTW: just find/replace tool is baregrep from the above company
 
(I'm underelated to Baremetalsoft. simply found the tool via Google search.)
GeneralVer 01.00.02.00memberamleth26 May '04 - 17:41 
New version available
 

http://www.amleth.com/ablogfile/ablogfile.html[^]
 
Ver 1.0.2.0 2004-05-27
Added. Option for displaying Full Path and LastModified time in window caption.
Fixed. Opening of file that may be locked by another process
Ver 1.0.1.0 2004-05-22
Added. option to poll file for changes, or to use windows notifications to check for file changes

Ver 1.0.0.2 2004-05-20
Fixed. Buffer overflow when a reloading a large file
 
Please let me know of any changes that you would like to appear in the next version.

 
Amleth Ojalen
Regards,
 
ABLogFile
ABBaseCalc
ABHotKeys
GeneralRe: Ver 01.00.02.00memberJaroslav Klumpler27 May '04 - 23:20 
Hi Amleth,
I tried your last version and it works just perfect for me, thanks. Smile | :)
When thinking about improvements, it'd be nice to have possibility to stop/start the logwindow update. I'm still not so good as people in the Matrix movie to see what's going on from characters running on the sreen. Wink | ;-)
 
As somebody mentioned before it'd be nice to have filters. Something like when you run 'tail -f foo | grep search_string' on linux to see only some messages. (Useful when more apps are loging to the same file and you want to see only one of them)
 
'Find' feature is also nice to have. But I'm not shure why anybody (see dtr2's post) needs 'replace'. In my opinion it breaks the philosophy of "viewer". But maybe it's only lack of my imagination. Smile | :)
 
Anyway thanks for your app again, it's very helpful for me and I'm looking forward to see future verions.
 
Regards,
Jaroslav
GeneralRe: Ver 01.00.02.00membersylvain222228 May '04 - 5:53 
An interesting feature for me could be : a kind of alert and/or highlight for some special string. For example I add in setting : "modem doesn't respond", and this string appear with yellow background in the texte and a button "Goto" become red.
Sylvain
GeneralEven more troublesmemberJaroslav Klumpler26 May '04 - 1:15 
I tried your tool and found out several problems:
1) I have a process that writes to a file and keeps this file opened all the time. When I try to load the file into your tool, it always ends up with sharing violation error. Other apps (like notepad) don't have any problem to open it.
 
2) Try to create new empty file, open it with your app and then double click on empty window... and you will end up with memory access error.
 
Thanks for sharing anyway. Wink | ;-)

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