whroeder, thanks for the fast answer, I will try to comment each point you've mentioned:
1 - I'm sorry about the code not formatted (I didn't know about it)!
2 - my specific problem is exactly like the first post of this topic (Xiaoshen Li): - "Each time new message shows up in "expert" tab, I need to right click the mouse and select "Open" to have the new message appended to the log file" at ..\Terminal\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\logs but on MT5, so I've try to use the modify the code to run on MT5 but I'm no being succeed to fix this problem!
3 and 4 - I'm absolutely new on MQL programming so I'm really sorry if my modified code doesn't make sense (I have to study more)
5 - Actually doesn't matter to me if my code right anything in anywhere else folder, I just use ..\Terminal\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\logs\yyyyMMdd.log to fill an excel file, but i really need this yyyyMMdd.log being updated as soon as possible, not only when I manually right click to "Open"