Page 1 of 1

MessageLogger--can it write each line immediately?!

Posted: Wed Jun 24, 2020 12:45 am
by RandallMcRee
My application is an 8.5 digit multimeter that uses megunolink. I use the message logger to output to a log file. I need to get the data into another program for real-time processing. Further processing needs 1) to use 64-bit double precision and 2) information available from other DMMs that are on a GPIB bus. So the framework I have to do this requires fusing the information from the megunolink DMM with GPIB DMMs using log files.

Long story short this works best if the message logger actually writes to the log without delay. Is there any way to accomplish this?

Thanks,
Randall.
e.g some Data:
2020-06-23 17:30:36: 5776140: C= 9.99977888
2020-06-23 17:30:37: 5777047: T= 28.64
2020-06-23 17:30:39: 5779226: C= 9.99977854

Re: MessageLogger--can it write each line immediately?!

Posted: Wed Jun 24, 2020 8:50 am
by philr
Hi, this is a limitation with the operating system. It chooses the right time to write data to disk. You can use the commands to stop and start the log from the arduino which I think will trigger the OS to write to disk.

Let me know how it goes.
Cheers
Phil

Re: MessageLogger--can it write each line immediately?!

Posted: Wed Jun 24, 2020 5:18 pm
by RandallMcRee
Sure, I can try that. It will be more expensive, certainly, than just calling
fflush
on the file. That is the correct way to do it--if you have a file handle.
https://www.techonthenet.com/c_language ... %20buffer.

My GPIB program (I don't have the source code) explicitly mentions this as the way to allow other programs monitoring the file to pick up the data in a timely manner. Also, you don't lose any data should the program writing the file crash.

Thanks,
Randall

Re: MessageLogger--can it write each line immediately?!

Posted: Wed Jun 24, 2020 11:13 pm
by RandallMcRee
Yes, a periodic

message.StopLogging();
message.StartLogging();

does the trick.

Re: MessageLogger--can it write each line immediately?!

Posted: Thu Jun 25, 2020 8:28 am
by philr
Great! We will add a flush command in a future update.

Cheers
Phil