问题
I'm using delphi 7.
I need to log to a file the complete informations of any exception that occurs.
Normally I use Eurekalog. This wonderful product shows a dialog with all the stack trace information and many many others for debugging purpouse.
I need to access this informations Eureka log gives me (really I need just the stack trace) because I need to send them in a syslog deamon. Is there a way to access the information from the Eureka log programmatically ?
I can use the bare delphi 7 or Eurekalog 6.1
回答1:
Handle the OnExceptionNotify event. In your event handler, do whatever you want with the AExceptionInfo.CallStack property, such as saving it to disk or sending it to some other process. Note that EurekaLog already saves bug reports to disk by default, so if that's all you want to do, you don't need any special code.
Use RegisterEventExceptionNotify to register your event handler, or use a TEurekaLogV7 component. For details and general information on handling EurekaLog events, see the documentation for the EEvents unit.
OnExceptionNotify
occurs for unhandled exceptions. If you want to be notified of any exception, including ones that eventually get handled within your program, then you should use the OnRaise event instead.
回答2:
Most people simply use JCL Debug.
Discussions on TSynlog http://blog.synopse.info/post/2011/04/14/Enhanced-logging-in-SynCommons
or by Hallvard Vassbotn http://hallvards.blogspot.co.at/2008/03/tdm9-exceptional-stack-tracing-hvest.html
来源:https://stackoverflow.com/questions/11937853/eurekalog-save-exception-stacktrace-into-a-log-file