Click here to Skip to main content
Licence CPOL
First Posted 6 Aug 2009
Views 17,778
Downloads 771
Bookmarked 23 times

Text Log Viewer

By | 19 Aug 2009 | Article
Text Log Viewer

Introduction 

Log viewer 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. 

In the settings part, you can find the highlight and icon options. With these options, you can determine the line color, backcolor or display icon for the criteria that you mentioned.

Log viewer displays only the last 100 (optional) lines for the log. This setting can be shown in the Log windows and can be incremented. For the developers opacity settings is included for those who want to see transparent Log Window. In the project, you will find directory watcher that watches directory and files for the changing. In this part, you can tail the changed files and you can open with one click.

This is the first version of the Log viewer and written in half a day. If you don't mind, please give feedback to improve. 

There are too many utilities like this one. BUT I just want to share this open source - advertisement free utility for free. If you like it, just use it and suggest some pretty options.

Background

Many of the applications write their log in a text based file. In all of my application, every step or critical function has a log option and I view these logs in runtime in test or real time working. I created this component for just that purpose.

Using the Code

Log Viewer using threads for viewing files. You can open multiple files with drag drop.

Dim s_SatirSayisi As Long = 0
Do

    Dim a As New System.IO.FileInfo(Dosya.DosyaTamYol)
    If Not (a.Exists) Then
        DosyaBulunamadi()
        Exit Do
    End If

    If Dosya.DosyaSonboyut <> a.Length Then

        If Dosya.DosyaSonboyut > a.Length Then
            Dosya.DosyaSonboyut = 0
        End If

        SonIslenenDosya(Dosya.DosyaTamYol)

        Dim veri() As String = DosyaOku(Dosya.DosyaTamYol, Dosya.DosyaSonboyut)
        Dosya.DosyaSonboyut = a.Length
        s_SatirSayisi = s_SatirSayisi + veri.Length
        SatirEkle(veri)

    End If

    System.Threading.Thread.Sleep(200)

Loop While Cls_Aktif

This thread is the main function that views the log files.

Points of Interest

The DataGridView is used for viewing the logs for each line with highlight and icon option. With this option, you can watch the file easily and I uninstall other log viewers. ;)

In this project, you will find:

  • Threading
  • Open and Read File
  • Datagridview usage
  • File System Watcher Usage
  • Registry Usage
  • XML Usage

Acknowledgements

  • .NET Docking Library for Windows Forms used for tab views (WeifenLuo.WinFormsUI.Docking)
  • XML+ Library (by Seyfettin Öztürk)

History

  • Initial release

Next

  • Find option (waiting)
  • Windows Event Log Viewing (Log Number After Max record is not changing, will be fixed)
  • Multi Language Support (GUI, only in English now)

özk@n

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

özk@n



Turkey Turkey

Member



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. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 2 Pinmemberjosetaza0:29 29 Jan '10  
General[My vote of 2] ok article PinmemberDonsw16:18 12 Sep '09  
GeneralExcellent ! but it adds only new line. Pinmemberomkarmango7:20 27 Aug '09  
GeneralInteresting PinmemberJohnny J.22:26 6 Aug '09  
GeneralRe: Interesting Pinmemberözk@n22:28 17 Aug '09  
GeneralTry BARETAIL.EXE PinmemberHightechRider13:23 6 Aug '09  
GeneralRe: Try BARETAIL.EXE PinmemberJohnny J.22:29 6 Aug '09  
GeneralRe: Try BARETAIL.EXE PinmemberHightechRider5:08 7 Aug '09  
GeneralSeems to be very functional, but ... PinmemberMartin08156:54 6 Aug '09  
GeneralRe: Seems to be very functional, but ... Pinmembermot2568:36 6 Aug '09  
GeneralRe: Seems to be very functional, but ... PinmemberMartin081521:56 6 Aug '09  
GeneralRe: Seems to be very functional, but ... Pinmemberözk@n22:29 17 Aug '09  
GeneralRe: Seems to be very functional, but ... PinmemberMartin081523:38 17 Aug '09  

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 20 Aug 2009
Article Copyright 2009 by özk@n
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid