- If you are looking for getting general exception information (class, message, address, etc.) - see How to get exception information?
- If you are looking for getting exception's call stack - see How to get exception's call stack?
- If you are looking for saving report file into database or network share (with screenshots, attached files, web page, dumps, etc.) - see How to save report instead of sending?
- If you want to operate on bug report file - see How to get file name for the bug report?
Normally you do not need to access bug report:
EurekaLog 7.7.8.2
Application:
-------------------------------------------------------
1.1 Start Date : Wed, 17 Oct 2018 16:23:33 +0300
1.2 Name/Description: Project1.exe
1.3 Version Number :
1.4 Parameters :
1.5 Compilation Date: Wed, 17 Oct 2018 16:23:15 +0300
1.6 Up Time : 6 second(s) Exception:
------------------------------------------------------------------------
2.1 Date : Wed, 17 Oct 2018 16:23:39 +0300
2.2 Address : 012A03F0
2.3 Module Name : Project1.exe
2.4 Module Version:
2.5 Type : ERangeError
2.6 Message : Range check error at Unit1.Button1Click (Line 261)
2.7 ID : ABBB0630
2.8 Count : 1
...
It is sufficient to use one of the mentioned above usage cases.
However, one particular example of when you want to access a simple bug report is when you are migrating old code from EurekaLog 6. Bug report was removed from OnExceptionNotify
event because bug report does not exist outside of exception processing in EurekaLog 7 (unlike EurekaLog 6). For example, if you decide not to handle exception in OnExceptionNotify
event handler - then there will be no bug report generated at all, thus saving processing time.
If you still want EurekaLog 6 style behavior - then bug report content can be retrieved from Dialog.BugReport
property at any time (which is basically a cache of LogBuilder.Report
property). For example:
uses
EException, // for TEurekaExceptionInfo
ELogBuilder; // for TBaseLogBuilder and RegisterEventEndReportGen
procedure UploadToDB(const ACustom: Pointer;
AExceptionInfo: TEurekaExceptionInfo;
ALogBuilder: TBaseLogBuilder;
var CallNextHandler: Boolean);
var
BugID: Cardinal;
Report: String;
begin
BugID := AExceptionInfo.BugID;
Report := ALogBuilder.Report;
// ... write bug report's content to your DB or
// do whatever you want with it
end;
initialization
RegisterEventEndReportGen(nil, UploadToDB, True);
end.
E.g. you should replace your OnExceptionNotify
event handler with OnEndReportGen
event handler. This event handler will be called like this:
- UploadToDB
- TBaseDialog.SaveBugReport
- TBaseDialog.Execute
- ShowException
- ProcessException
- ExceptionManager.Handle
- Forms.TApplication.HandleException
Alternatively, bug report can be created at any time (on demand) - by using BuildBugReport
function:
uses
EException, // for TEurekaExceptionInfo
ELogBuilder; // for BuildBugReport
var
EI: TEurekaExceptionInfo;
Report: String;
begin
try
// ...
except
on E: Exception do
begin
EI := ExceptionManager.Info(E);
// EI = nil for disabled EurekaLog
// or when exception is ignored
if Assigned(EI) then
begin
Report := BuildBugReport(EI);
// ... write bug report's content to your DB
// or do whatever you want with it
end;
end;
end;
LogText
? – David Heffernan