Discussion of article "Finding Errors and Logging"

 

New article Finding Errors and Logging is published:

MetaEditor 5 has the debugging feature. But when you write your MQL5 programs, you often want to display not the individual values, but all messages that appear during testing and online work. When the log file contents have large size, it is obvious to automate quick and easy retrieval of required message. In this article we will consider ways of finding errors in MQL5 programs and methods of logging. Also we will simplify logging into files and will get to know a simple program LogMon for comfortable viewing of logs.

Author: Дмитрий Александрович

 

Thanks for the article. For a long time I wanted to create something like this, but all hands did not come up. And now... I'm already using it.

 
papaklass:

I liked the article too, thanks. Because MT prints with skips and it is very inconvenient.

The skips are only in the "Experts" tab. All messages are in the log file.
 

I was more into this or similar things:

void PrintDebugInfo(string InputString)
{
  CopyTime(Symbol(),Period(),0,1,Time);
  ArraySetAsSeries(Time,true);
  FileWrite(FileHandle,Time[0],"   ",InputString);
}

Thanks for the code, we'll use it....

 
Lizar:

Thanks for the article. For a long time I wanted to create something like this, but all hands did not come up. And now... I'm already using it.

You are welcome to use it! :)
As you use it, I will improve the class and the program, because I wrote first for myself, and then the article came to mind))))
 

Very useful material!

 

The attached .exe is still in Russian language. Can you please re-up it?

P.S. This is really useful! One of the first classes that should be declared in any OOP project is one to handle errors!

 
Thank you for your comment. Now you can find correct English version of this utility in attached files.
 

If you forget to use flush, data loss may occur.

 A better solution would be the following:


private:
   void              flush(void);              // Flushing cache into file
//+------------------------------------------------------------------+
//|   Deinitialization                                               |
//+------------------------------------------------------------------+
void CLogger::deinit(void)
  {
   flush();  // Flush data
   FileClose(handleFile); // Close file
  }

So that the data save is automatically.

 

ps.: I'm sorry if I offended spelling, the google translator helped me...

 

Dmitry Alexandrovich, thank you for your work, I have been looking for something like this for a long time and finally found it ))

suggestion to improve logmon.exe, to make a setting that would be able to specify the paths where to look for files with logs, because to have two copies in different folders (for the tester and standard work) somehow amateurish ))

although maybe I'll finish it myself when I get my hands on it ))

if you have anything else useful - post it, your style of programming and presentation of material is very braindead )).

 

I get an error when debugging on historical data: "MQL5 debugger failed to start debugging 'testlogger.ex5' on history". On real data it works fine.

Can you please tell me what I need to tweak to make it work on history?