Download MetaTrader 5
To add comments, please log in or register
One billion tasks have already been executed with MQL5 Cloud Network. Test trading robots even faster!
Walter Kozlowski
10
Walter Kozlowski 2014.04.28 08:29 

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

fonx
52
fonx 2015.07.13 19:52  

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

fonx
52
fonx 2015.07.13 20:28  

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 

whroeder1
13596
whroeder1 2015.07.14 02:02  
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.
Ovo Cz
2958
Ovo Cz 2015.07.14 05:49  

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.

/
To add comments, please log in or register