delphidelphi-6madexcept

Logging call stack into file


I am using Madexcept tool to log the exceptions, but I am not able to log the call stack in periodically. Can any one suggest me how to log the call stack.


Solution

  • The naive answer to your question is that you can do the following, inside a dedicated thread:

    var
      exc: IMEException;
    ....
    exc := madExcept.NewException;
    Logger.Log(exc.BugReport);
    

    Note that this logs the entire bug report. If you want to log less information, you can use the normal madExcept techniques to extract that information from the IMEException reference.

    Also be warned that gathering all this information takes a significant amount of time, and will interfere with the execution of your program. It seems to me that what you really want is a profiler, or some trace logging. I don't think that madExcept is actually the solution to your underlying problem.