1
votes

While migrating from EurekaLog 6 to 7, I came to notice a compiler warning that TEurekaExceptionRecord is deprecated and I should use TEurekaExceptionInfo.

In my Delphi 7 app with EurekaLog 6, there is a statement like:

exceptionRecord : TEurekaExceptionRecord; 
myString := exceptionRecord.logText;

Now when I am using TEurekaExceptionInfo instead of TEurekaExceptionRecord in my Delphi XE4 with EurekaLog 7 like following:

exceptionInfo : TEurekaExceptionInfo;
myString := exceptionInfo.logText;

I am getting error on the second line because logText does not exist now. Which method has replaced it in EurekaLog 7?

2
ExceptionInfo.ToString?kobik
@kobik - Thanks for your reply, but I think replacing logText with Tostrng will reduce the log information as per this discussion: news.eurekalog.com/showthread.php?t=3248user1556433
What are you doing with LogText?David Heffernan
@nkp: why don´t you ask that to the vendor?AlexSC

2 Answers

2
votes

I am the EurekaLog support person. There are large differences between v6 and v7. Your question is difficult to answer since while the globals you are used to in v6 remain in v7, you may not be able to modify or check them in the same way in v7. Success is dependent on when you read or modify the variables. There are several event handlers and each one reads/writes various fields in our EL classes. They are called sequentially, so this is where the timing issue I mentioned comes in. Log text is now created in our dialog box classes, but there are ways to extract raw log text from them.

I recommend that you open a trouble ticket on our web site and post some code that demonstrates what you are trying to do. You can also check our code snippets library for log management ideas.

0
votes
  1. If you are looking for getting general exception information (class, message, address, etc.) - see How to get exception information?
  2. If you are looking for getting exception's call stack - see How to get exception's call stack?
  3. 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?
  4. 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;