0

I have a program that is created with c++, when I have enabled debug mode, the program block because of the high log volume , is there any solution or idea to avoid blocking in debug mode or is there an intelligent method to create logs in debug mode

  • Depending on your logging solution: you could change the log level so only warnings and errors get logged. You could disable logging altogether. If you're logging to a file maybe logging to RAM speeds things up. You could set up a RAM drive and use that as log file target. Or find a better, more optimized logging solution. Quick google search: https://github.com/gabime/spdlog – tiguchi Oct 12 '19 at 17:55

1 Answers1

1

Using buffered I/O can speed things up compared to unbuffered I/O. See this stackoverlow question for further information. However, if your program crashes, maybe not all data will have been written to the log file, which will make diagnosing the reason for the crash harder. Therefore, the buffer should be flushed immediately before a potential crash, for example using fflush or std::flush, depending on which functions you are using for output.

You may already be using buffered I/O, though. Since you did not specify which functions you are using for I/O, I cannot tell.

Andreas Wenzel
  • 22,760
  • 4
  • 24
  • 39