MQL4 upgrade to 6xxx problem with printing to log file

 

Hi

My EA was logging into log file using Print() function without any problem. After the upgrade the text is logged but is not visible until I remove EA and close the terminal! Look like problem with buffer flushing?

Please help

WalterMK

 

Hi did you find any solution for this problem. I'm stuck in the same situation and it is just know after reading your post that I managed to get the text into the file after stopping the EAs and closing the terminal. For instance if I just close the terminal it doesn't seem to flush the text into the log file.

I haven't tried to wait till next day to see if it flushes into the previous day file. I'll try it tonight, but I need the logs as soon as possible. I hope someone can help.

I use Oanda MT4 Version 4.00 Build 842

 

As I've found in other threads (i.e. https://www.mql5.com/en/forum/123099) apparently MT4 only flushes when it wants. The thread is from 2010 but seems that MT4 continues on that line.

I don't know the reason, honestly :P 

 
If it flushed every byte it would be a tremendous burden on disk, CPU, and RAM. Every Operating System flushes periodically. If you want otherwise use a file and flush it yourself.
 

The problem is that MT4 file flush seems to behave differently than the operating system flush, it apparently has an additional buffer layer in the application. When using the operating system, if you try to access the unflushed file for reading, you actually get to the file buffer, and the accessed file data is complete. On the other hand, with the MT4 the file data is always incomplete without flush, and sometimes it misses a few last bytes even with the flush.

Reason: