Also, these days, powerful IDEs and remote debugging are what many protocols really fail.
Yes, absolutely, although the mistake that many unskilled developers make is to try to fix the errors using the wrong method, usually trying to log when they should be debugged. There is a place for everyone, but there are at least a few areas where logging is almost always necessary:
- To study problems in real-time code, when a suspension with a debugger will lead to a calculation result (provided, logging will have a small effect on synchronization in real-time, like this, but how much it depends on the software)
- For builds sent to beta testers or other colleagues who don’t have access to the debugger
- To flush data to disk that is not easy to view in the debugger. For example, a specific IDE that cannot properly parse STL structures.
- To "feel" the normal flow of your program
- To make the code more readable in addition to the comments, for example:
// Now open the data file
fp = fopen ("data.bin", "rb");
The above comment can be just as easily posted in the journal:
const char * kDataFile = "data.bin";
log ("Now opening the data file% s", kDataFile);
fp = fopen (kDataFile, "rb");
However, you are in some way correct. Using the registration mechanism as an illustrative stack trace logger will create very poor quality log files, since it does not provide a sufficiently useful downtime for the developer to study. Thus, the key here is obviously the correct and reasonable use of registration calls, which I think comes down to the discretion of the developer. You should consider that you essentially make log files for ; your users do not care about them and, as a rule, roughly misinterpret their contents, but you can use them to at least determine why your program behaves badly.
In addition, it is rare that a log file will point you to the direct source of a specific error. In my experience, it usually gives some insight into how you can replicate the error, and then either by replicating it or debugging, find the cause of the problem.
Nik Reiman Sep 30 '08 at 15:47 2008-09-30 15:47
source share