Is it possible to obtain a stack trace of an exception at runtime from the included CodeSite express? If so, does anyone have any experience with, or examples of, doing this?
Failing that, is there a way to achieve this with an open source library?
I introduced logging to a 10+ year old Delphi application, so there's still a considerable proportion of the application without logging. So for areas that are yet to be rewritten, I have an Application.OnException hook. It would be very useful to have a meaningful stack trace of the sporadic access violations we get in production. Below is what I already have, and I was disappointed to find the StackTrace property empty.
class procedure Log.Error(const err: Exception; const method: string);
begin
FileLog(err, method);
end;
class procedure Log.FileLog(const err: Exception; const method: string);
var
_msg: TStringList;
begin
//_msg := Format('%s Failed:%3:s%1:s%3:s %2:s%3:s', [PreparedEntry(method), err.Message, err.StackTrace, sLineBreak]);
_msg := PreparedEntry( Format('%s Failed:', [method]));
_msg.Add(err.Message);
_msg.Add(err.StackTrace);
WriteLog(_msg, _logFileName);
end;
We are in an advanced stage of migrating from a delphi win32 application to a multi-tiered .net wcf server application still serving the delphi client application. The long and short of this is that after convincing management to purchase Delphi XE5 (just to get the improved json support and live bindings) asking for another delphi purchase is very hard to justify.
Thanks