Read the last changes in a log file

Please discuss general Delphi programming topics here.

Read the last changes in a log file

Postby Zvikai » July 22nd, 2010, 9:41 am

Hi all,

Is there a way to monitor a text file (log file) for changes and then read the last block of text that was appended ?

Thanks,
Z
Zvikai
Active Member
Active Member
 
Posts: 7
Joined: September 24th, 2008, 10:47 am

Re: Read the last changes in a log file

Postby Kambiz » July 30th, 2010, 2:09 am

I don't know how to monitor a single file, but I know Windows has API for monitoring changes in a directory.

  • FindFirstChangeNotification
  • FindNextChangeNotification
  • FindCloseChangeNotification
The TShellChangeNotifier component implements these APIs, and is very easy to use.

The TShellChangeNotifier component is part of the Shell Controls package, which is shipped with Delphi but is not installed by default. When you install the Shell Controls package, the components will appear in the Samples palette.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron