Download MetaTrader 5

MQL4 upgrade to 6xxx problem with printing to log file

To add comments, please log in or register
Do you want to learn MQL5? 300 articles will help you!
Walter Kozlowski
Walter Kozlowski 2014.04.28 08:29 


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


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 2015.07.13 20:28  

As I've found in other threads (i.e. 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 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.
Ex Ovo Omnia
Ex Ovo Omnia 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