• We've upgraded our forums. Please post any issues/requests in this thread.

Visual basic text file nightmare

Joined
Dec 22, 2007
Messages
184 (0.05/day)
Likes
7
Location
Central Nebraska
System Name CORSAIR
Processor AMD Phenom 1090T x6 @3.2
Motherboard Gigabyte Ga-78LMT-S2P
Cooling High efficiency dust cooling
Memory 8GB GSkill DDR3 1333
Video Card(s) Sapphire Radeon HD3870 512MB GDDR4 PCI-e toxic
Storage Seagate SV35.3 ST3250310SV 250GB SATAII(Windows 7 Pro x64), 320GB Samsung SATAII(Storage and SuSE)
Display(s) Dell 20" LCD, Dell 17" LCD
Power Supply Antec Cool Blue 650W Modular
Software Windows 7 Professional SP1, Visual Studio 2010 Ultimate
#1
Hello, I am writing a program that needs to be able to read from a text file and display its output into a multiline text box. I have this part done. my problem is, I need this to update in real time as the text file im reading from is a log that keeps track of uploading of files etc. the method i had had in mind to update the text box in real time was to loop the reading of the text file and add a thread.sleep(5000) line in the loop, giving 5000 milliseconds before it refreshes- this method causes the program to freeze. any other ideas on how to do this? Thanks in advance
-sean
 

temp02

New Member
Joined
Mar 18, 2009
Messages
493 (0.15/day)
Likes
165
#2
It has been while since I've messed with Visual Basic but I'm pretty sure there is a visual component called Timer (or something equivalent), add one to the form, double click on it and add your "loop" code, now without the loop, to it, then set the timer interval property to 5000 and your set.
 

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
17,065 (3.44/day)
Likes
17,973
Processor Core i7-4790K
Memory 16 GB
Video Card(s) GTX 1080
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 7
#3
read up on FindFirstChangeNotification and related functions, for the correct way to do this (in a second thread)

what is probably easier for you is using settimer to periodically get a timer called
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
20,921 (6.24/day)
Likes
10,022
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#4
If it were me, I'd make a separate class with the reader in it then have it raise an event whenever new lines were detected (each event raised would contain the line). That way, the GUI only updates when it needs to.
 

Kreij

Senior Monkey Moderator
Staff member
Joined
Feb 6, 2007
Messages
13,817 (3.48/day)
Likes
5,524
Location
Cheeseland (Wisconsin, USA)
Processor Intel Core 2 Quad QX9650 Extreme @ 3.0 GHz
Motherboard Asus Rampage Formula
Cooling ZeroTherm Nirvana NV120 Premium
Memory 8GB (4 x 2GB) Corsair Dominator PC2-8500
Video Card(s) 2 x Sapphire Radeon HD6970
Storage 2 x Seagate Barracuda 320GB in RAID 0
Display(s) Dell 3007WFP 30" LCD (2560 x 1600)
Case Thermaltake Armor w/ 250mm Side Fan
Audio Device(s) SupremeFX 8ch Audio
Power Supply Thermaltake Toughpower 750W Modular
Software Win8 Pro x64 / Cat 12.10
#5
You didn't mention what application is doing the writing to the text file, but you will probably want to implement error checking in there when reading the file.
If the app doing the writing has an exclusive lock on the file that prevents any other app from accessing it for either reading or writing, your app will throw access denied exceptions when trying to open it for a read.

Disclaimer : It's Monday
 
Joined
Nov 30, 2008
Messages
555 (0.17/day)
Likes
28
Location
Birmingham, England...
Processor Intel Core 2 Quad Q6600 @ 2.8GHz
Motherboard Gigabyte X48T-DQ6
Cooling Zalman 9500 LED CPU Cooler
Memory 2x 2GB Corsair DDR3 XMS3 DHX - 1600MH/PC3-12800
Video Card(s) Gigabyte HD4870 1GB
Storage 2x Seagate 320GB Barracuda (RAID 0) 3x 1TB Samsung F3, 140GB WD Maxtor (10,000rpm)
Display(s) 2x 20" LG Flatron L204WS
Power Supply Powercool 850W
Software Windows 7 Ultimate x64
#6
You didn't mention what application is doing the writing to the text file, but you will probably want to implement error checking in there when reading the file.
If the app doing the writing has an exclusive lock on the file that prevents any other app from accessing it for either reading or writing, your app will throw access denied exceptions when trying to open it for a read.

Disclaimer : It's Monday
Been a while since I monitored this topic, I don't think I ever got around to saying... THANK YOU KREIJ for helping me graduate university!!!
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
20,921 (6.24/day)
Likes
10,022
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#7
FYI, you can work around file locks by having CMD do a copy. CMD copy ignores file locks. Read the copied file, then delete the copy when done.
 
Joined
Dec 13, 2007
Messages
2,758 (0.75/day)
Likes
465
#8
Hope i'm not to late... But like said by others

Use a timer. set the internal to 5000.... if it still cause freezes. I would try "backgroundworker" to grab the text file, and then have timer to read it...
 
Joined
Dec 1, 2007
Messages
528 (0.14/day)
Likes
13
Location
Karachi, Pakistan
System Name mAkS
Processor Intel Core 2 Duo E0 E8400 @3.0Ghz (Acheived 4.4Ghz On Stock Cooling)
Motherboard Asus P5K-V (Dead :[ )
Cooling CPU + Front + Rear + Side
Memory XMS2 DHX TWIN2X2048-6400C5DHX/800 BUS
Video Card(s) Inno3D 9600 GT Overclocked
Storage Seagate Sata II 250 GB ++ 500 GB
Display(s) Hp 2009f 20-inch Wide-screen
Case Legend
Audio Device(s) Build-In 8 CHannel (Dell 5.1")
Power Supply CoolerMaster 460W eXtreme Power Plus
Software Many
Benchmark Scores E8400 hardware rank 94th on hwbot in wPrime :D
#9
Application.DoEvents()

This might solve the problem, Which version of VB are you using?
 

Kreij

Senior Monkey Moderator
Staff member
Joined
Feb 6, 2007
Messages
13,817 (3.48/day)
Likes
5,524
Location
Cheeseland (Wisconsin, USA)
Processor Intel Core 2 Quad QX9650 Extreme @ 3.0 GHz
Motherboard Asus Rampage Formula
Cooling ZeroTherm Nirvana NV120 Premium
Memory 8GB (4 x 2GB) Corsair Dominator PC2-8500
Video Card(s) 2 x Sapphire Radeon HD6970
Storage 2 x Seagate Barracuda 320GB in RAID 0
Display(s) Dell 3007WFP 30" LCD (2560 x 1600)
Case Thermaltake Armor w/ 250mm Side Fan
Audio Device(s) SupremeFX 8ch Audio
Power Supply Thermaltake Toughpower 750W Modular
Software Win8 Pro x64 / Cat 12.10
#10
Been a while since I monitored this topic, I don't think I ever got around to saying... THANK YOU KREIJ for helping me graduate university!!!
My pleasure, Akumos, always happy to help any way I am able.
Congrats on your graduation (I can't believe you didn't invite me to your graduation party. :shadedshu :laugh:) and I think I will add "Helped people graduate" to my resume. lol
 
Joined
Dec 22, 2007
Messages
184 (0.05/day)
Likes
7
Location
Central Nebraska
System Name CORSAIR
Processor AMD Phenom 1090T x6 @3.2
Motherboard Gigabyte Ga-78LMT-S2P
Cooling High efficiency dust cooling
Memory 8GB GSkill DDR3 1333
Video Card(s) Sapphire Radeon HD3870 512MB GDDR4 PCI-e toxic
Storage Seagate SV35.3 ST3250310SV 250GB SATAII(Windows 7 Pro x64), 320GB Samsung SATAII(Storage and SuSE)
Display(s) Dell 20" LCD, Dell 17" LCD
Power Supply Antec Cool Blue 650W Modular
Software Windows 7 Professional SP1, Visual Studio 2010 Ultimate
#11
Sorry for the long response, but I am just now getting back to this abandoned part in the project -
I have resorted to just creating this in its own seperate app till I get this working before implementing it in the project. SO... I have some code for you guys. This is the best thing I have got so far... IF you use this in a consoel application and change the line that outputs this to the textbox to "console.writeline(line)" it works flawlessly. But as a windows forms application... nooot so much. try it and see.
-----------------------------------------

Imports System.IO

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Using reader As New StreamReader(New FileStream("C:\logtest\test.txt", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
'start at the end of the file
Dim lastMaxOffset As Long = reader.BaseStream.Length

Do
System.Threading.Thread.Sleep(100)

'if the file size has not changed, idle
If reader.BaseStream.Length = lastMaxOffset Then
Continue Do
End If

'seek to the last max offset
reader.BaseStream.Seek(lastMaxOffset, SeekOrigin.Begin)

'read out of the file until the EOF
Dim line As String = ""
line = reader.ReadLine()
Do While line IsNot Nothing
TextBox1.AppendText(line)
line = reader.ReadLine()

Loop

'update the last max offset
lastMaxOffset = reader.BaseStream.Position
Loop

End Using
End Sub
End Class

Edit: P.s. Using Visual Studio 2010 Ultimate
 
Last edited:
Joined
Dec 13, 2007
Messages
2,758 (0.75/day)
Likes
465
#12
If your only reading the first line of the text file use something like this... I don't see the point of running a loop if only the first line is been read, But of coarse this will read the line no matter what.

Code:
        Using reader As New StreamReader("C:\logtest\test.txt")
            'Reading only the first line in test.txt
            Dim line As String = ""
            line = reader.ReadLine()
            TextBox1.AppendText(line)
        End Using
now to have to it read it every 5000ms (5sec)

Code:
Imports System.IO

Public Class Main

    Private Sub Main_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        ReaderTimer.Start()
    End Sub
    Private Sub ReaderTimer_Tick(sender As System.Object, e As System.EventArgs) Handles ReaderTimer.Tick
        ReaderTimer.Interval = 5000
        Using reader As New StreamReader("C:\logtest\test.txt")
            'Reading only the first line in test.txt
            Dim line As String = ""
            line = reader.ReadLine()
            TextBox1.AppendText(line)
        End Using
    End Sub
End Class
 

Kreij

Senior Monkey Moderator
Staff member
Joined
Feb 6, 2007
Messages
13,817 (3.48/day)
Likes
5,524
Location
Cheeseland (Wisconsin, USA)
Processor Intel Core 2 Quad QX9650 Extreme @ 3.0 GHz
Motherboard Asus Rampage Formula
Cooling ZeroTherm Nirvana NV120 Premium
Memory 8GB (4 x 2GB) Corsair Dominator PC2-8500
Video Card(s) 2 x Sapphire Radeon HD6970
Storage 2 x Seagate Barracuda 320GB in RAID 0
Display(s) Dell 3007WFP 30" LCD (2560 x 1600)
Case Thermaltake Armor w/ 250mm Side Fan
Audio Device(s) SupremeFX 8ch Audio
Power Supply Thermaltake Toughpower 750W Modular
Software Win8 Pro x64 / Cat 12.10
#13
He's not reading the first line. He's reading any new lines that have been appended to the end of the file since the last read.

Something you may want to consider, shuggans, is append the new lines to the top of the TextBox so that the newest entry in the file is always at the top.
You could then truncate the contents of the textbox if it gets longer than you want.

Just a suggestion. :toast:
 
Joined
Dec 13, 2007
Messages
2,758 (0.75/day)
Likes
465
#14
He's not reading the first line. He's reading any new lines that have been appended to the end of the file since the last read.

Something you may want to consider, shuggans, is append the new lines to the top of the TextBox so that the newest entry in the file is always at the top.
You could then truncate the contents of the textbox if it gets longer than you want.

Just a suggestion. :toast:
ah yea i didn't catch that :p
 
Joined
Dec 22, 2007
Messages
184 (0.05/day)
Likes
7
Location
Central Nebraska
System Name CORSAIR
Processor AMD Phenom 1090T x6 @3.2
Motherboard Gigabyte Ga-78LMT-S2P
Cooling High efficiency dust cooling
Memory 8GB GSkill DDR3 1333
Video Card(s) Sapphire Radeon HD3870 512MB GDDR4 PCI-e toxic
Storage Seagate SV35.3 ST3250310SV 250GB SATAII(Windows 7 Pro x64), 320GB Samsung SATAII(Storage and SuSE)
Display(s) Dell 20" LCD, Dell 17" LCD
Power Supply Antec Cool Blue 650W Modular
Software Windows 7 Professional SP1, Visual Studio 2010 Ultimate
#15
I need to have the whole log available to view-
The log isnt updated all that often, and the point of it in the program is so you never have to hunt the log down and open it in notepad.

would it be better to use something other than a textbox to do this, such as a combobox?

also, crackerjack, I haven't used timers since my IRC script kiddie days. Certainly never in VB before, how do I properly define the timer used in the code you posted, and I could try just modifying it to readtoend
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
20,921 (6.24/day)
Likes
10,022
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#16
You never want to read-to-end because it is inefficient in every regard (unless it is a very, very small file). What you'll want to do is keep record of the offset of your last read and whenever the file length changes, jump to the last offset then read the lines until the end of file (rince and repeat).

I would probably use a ListBox--one item per line--perhaps bound to a stack to always place the most recent item at the top.
 
Joined
Dec 22, 2007
Messages
184 (0.05/day)
Likes
7
Location
Central Nebraska
System Name CORSAIR
Processor AMD Phenom 1090T x6 @3.2
Motherboard Gigabyte Ga-78LMT-S2P
Cooling High efficiency dust cooling
Memory 8GB GSkill DDR3 1333
Video Card(s) Sapphire Radeon HD3870 512MB GDDR4 PCI-e toxic
Storage Seagate SV35.3 ST3250310SV 250GB SATAII(Windows 7 Pro x64), 320GB Samsung SATAII(Storage and SuSE)
Display(s) Dell 20" LCD, Dell 17" LCD
Power Supply Antec Cool Blue 650W Modular
Software Windows 7 Professional SP1, Visual Studio 2010 Ultimate
#17
and kreij, If you try the code I had as a console app, it works great. In a windows form, it causes the app to become unresponsive. and idea why? this has to be possible to do...
Is there a way to embed a console into a vb.net form?
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
20,921 (6.24/day)
Likes
10,022
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#18
If the application ever becomes unresponsive, it is because something is tying up the main thread that needs to be moved to a worker thread.

No, you can simulate a console in a Windows Form but they are different (CUI vs GUI) on an executable level.


How many files are you trying to monitor? Just one?
 
Joined
Dec 22, 2007
Messages
184 (0.05/day)
Likes
7
Location
Central Nebraska
System Name CORSAIR
Processor AMD Phenom 1090T x6 @3.2
Motherboard Gigabyte Ga-78LMT-S2P
Cooling High efficiency dust cooling
Memory 8GB GSkill DDR3 1333
Video Card(s) Sapphire Radeon HD3870 512MB GDDR4 PCI-e toxic
Storage Seagate SV35.3 ST3250310SV 250GB SATAII(Windows 7 Pro x64), 320GB Samsung SATAII(Storage and SuSE)
Display(s) Dell 20" LCD, Dell 17" LCD
Power Supply Antec Cool Blue 650W Modular
Software Windows 7 Professional SP1, Visual Studio 2010 Ultimate
#19
there will be two separate txt files monitored in two separate text or combo boxes side by side.
 

Kreij

Senior Monkey Moderator
Staff member
Joined
Feb 6, 2007
Messages
13,817 (3.48/day)
Likes
5,524
Location
Cheeseland (Wisconsin, USA)
Processor Intel Core 2 Quad QX9650 Extreme @ 3.0 GHz
Motherboard Asus Rampage Formula
Cooling ZeroTherm Nirvana NV120 Premium
Memory 8GB (4 x 2GB) Corsair Dominator PC2-8500
Video Card(s) 2 x Sapphire Radeon HD6970
Storage 2 x Seagate Barracuda 320GB in RAID 0
Display(s) Dell 3007WFP 30" LCD (2560 x 1600)
Case Thermaltake Armor w/ 250mm Side Fan
Audio Device(s) SupremeFX 8ch Audio
Power Supply Thermaltake Toughpower 750W Modular
Software Win8 Pro x64 / Cat 12.10
#20
Since your loop is in the main UI thread it's causing the UI to be unresponsive.
Put that in a worker thread as Ford stated.

I see some issues with maintaining an offset on repeated runs of the app, as if the logfile gets deleted or truncated, the offset will be wrong.
 
Joined
Dec 22, 2007
Messages
184 (0.05/day)
Likes
7
Location
Central Nebraska
System Name CORSAIR
Processor AMD Phenom 1090T x6 @3.2
Motherboard Gigabyte Ga-78LMT-S2P
Cooling High efficiency dust cooling
Memory 8GB GSkill DDR3 1333
Video Card(s) Sapphire Radeon HD3870 512MB GDDR4 PCI-e toxic
Storage Seagate SV35.3 ST3250310SV 250GB SATAII(Windows 7 Pro x64), 320GB Samsung SATAII(Storage and SuSE)
Display(s) Dell 20" LCD, Dell 17" LCD
Power Supply Antec Cool Blue 650W Modular
Software Windows 7 Professional SP1, Visual Studio 2010 Ultimate
#21
This is my firs whack at multi threading, what did I do wrong, form still locks up:

Imports System.IO
Imports System.Threading

Public Class Form1


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
readlog()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
Public Sub readlog()
Dim Thread_UploadLogReader As New System.Threading.Thread(AddressOf readlog)
Thread_UploadLogReader.Start()
Using reader As New StreamReader(New FileStream("C:\logtest\test.txt", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
'start at the end of the file
Dim lastMaxOffset As Long = reader.BaseStream.Length

Do
System.Threading.Thread.Sleep(100)

'if the file size has not changed, idle
If reader.BaseStream.Length = lastMaxOffset Then
Continue Do
End If

'seek to the last max offset
reader.BaseStream.Seek(lastMaxOffset, SeekOrigin.Begin)

'read out of the file until the EOF
Dim line As String = ""
line = reader.ReadLine()
Do While line IsNot Nothing
TextBox1.AppendText(line)
line = reader.ReadLine(line)
Loop

'update the last max offset
lastMaxOffset = reader.BaseStream.Position
Loop

End Using
End Sub
End Class
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
20,921 (6.24/day)
Likes
10,022
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#23
I see some issues with maintaining an offset on repeated runs of the app, as if the logfile gets deleted or truncated, the offset will be wrong.
If file.Length < lastoffset Then
' Start over
End If

Edit: I'm trying to think if I already coded a generic line parser but I don't think I did. They were always specific to a format (broke down every line into parts) so nothing I have would work out of the box. It really wouldn't be hard to make one though.
 

Kreij

Senior Monkey Moderator
Staff member
Joined
Feb 6, 2007
Messages
13,817 (3.48/day)
Likes
5,524
Location
Cheeseland (Wisconsin, USA)
Processor Intel Core 2 Quad QX9650 Extreme @ 3.0 GHz
Motherboard Asus Rampage Formula
Cooling ZeroTherm Nirvana NV120 Premium
Memory 8GB (4 x 2GB) Corsair Dominator PC2-8500
Video Card(s) 2 x Sapphire Radeon HD6970
Storage 2 x Seagate Barracuda 320GB in RAID 0
Display(s) Dell 3007WFP 30" LCD (2560 x 1600)
Case Thermaltake Armor w/ 250mm Side Fan
Audio Device(s) SupremeFX 8ch Audio
Power Supply Thermaltake Toughpower 750W Modular
Software Win8 Pro x64 / Cat 12.10
#24

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
20,921 (6.24/day)
Likes
10,022
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#25
That would result in an "oops." That issue is negated by more frequently checking the size (like 100ms instead of 5000ms).

You can also go by date-modified too but, in this situation, I'd perfer length so if the application that's writing the log just touches the file (opens a write stream and closes it), it doesn't invoke an update.