我们如何使用附带的CodeSite Express在Delphi XE 5中获取堆栈跟踪?

时间:2014-07-07 10:19:16

标签: delphi exception logging delphi-xe5 codesite

是否可以在运行时从包含的CodeSite express获取异常的堆栈跟踪?如果是这样,有没有人有这方面的经验或实例?

如果失败了,有没有办法用开源库来实现这个目标?

我将日志记录引入了一个已有10年历史的Delphi应用程序,因此在没有日志记录的情况下,仍有相当大比例的应用程序。因此,对于尚未重写的区域,我有一个Application.OnException挂钩。对我们在生产中获得的零星访问冲突进行有意义的堆栈跟踪将非常有用。以下是我已经拥有的内容,我很失望地发现StackTrace属性为空。

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;

我们正处于从delphi win32应用程序迁移到仍然为delphi客户端应用程序提供服务的多层.net wcf服务器应用程序的高级阶段。长期和短期是在说服管理层购买Delphi XE5(只是为了获得改进的json支持和实时绑定)之后,要求再购买delphi是非常难以证明的。

由于

1 个答案:

答案 0 :(得分:5)

Jedi代码库中的JCLDebug单元将允许您获得堆栈跟踪,然后可以通过CodeSite传递。就个人而言,我使用的madExcept更灵活,非常值得投资。这将允许您通过代码站点记录整个错误报告(包括堆栈跟踪)。