Root > Solving bugs in your code > Logging > Integrations with 3rd party frameworks > TMS Logging

Using EurekaLog with TMS Logging

Previous pageReturn to chapter overviewNext page   

TMS Logging is a compact cross-platform logging framework offering informative log output to a flexible number of targets with a minimum amount of code.



TMS Logging to EurekaLog

If you are using TMS Logging in your application - it may be useful to get TMS Logging output as part of your EurekaLog's crash reports, so you will get a better understanding of execution flow of your application before crash.


TMS Logging supports custom output handlers, so you may simply redirect all logging from TMS Logging to EurekaLog by:




TMSLoggingEurekaLogOutputHandler unit can be found in \Source\Extras\ folder of your EurekaLog installation. You can activate this output handler by using the usual construct:




This will create EurekaLog log file according to default rules. If you wish to specify file name or location - use ELogOpen function to open log file before registering output handler. In any case - EurekaLog log file will be automatically appended to crash report:



EurekaLog log file inside EurekaLog's crash report

Double-click log file to view in viewer tool


Additionally, you may make a local copy (e.g. copy file to project) of TMSLoggingEurekaLogOutputHandler unit if you want to make modifications.


This approach is recommended over the alternative (see below), because it sends log in a formalized format, allowing for client-side manipulations in viewer tool.



TMS Logging to EurekaLog (alternative)

You may attach TMS Logging output as file directly (without converting to EurekaLog's logging).


Note: TMS Logging only provide saving to text formats (text, HTML, CSV). That is why we recommend to use above mentioned method instead (when possible).


You can attach the log file from TMS Logging with the following code example:


Important Note: example below will add a new file with log output from TMS Logging. The new file will be added inside EurekaLog's bug report that is being send to developers. E.g. you have to set up sending to receive this file. The local EurekaLog's report do not store any additional files. If you wish to capture .elp file locally for testing purposes - see this example.



  VCL.TMSLogging,  // for TMS Logging routines
  // You can also use TMSLoggingHTMLOutputHandler
  // Please, refer to TMS Logging documentation 
  EException,      // for TEurekaExceptionInfo

  ESysInfo,        // for GetFolderTemp
  EEvents;         // for RegisterEventZippedFilesRequest
  // File name for TMS log file
  GTMSLogFileName: String;
// Initialize TMS Logging to save log to text file
// This is just an example
// You may replace/customize it
// Please, refer to TMS Logging documentation
procedure InitTMSLogging;
  GTMSLogFileName := GetFolderTemp +
    ChangeFileExt(ExtractFileName(ParamStr(0)), '.txt'); 

  TMSLogger.RegisterOutputHandlerClass(TTMSLoggerTextOutputHandler, [GTMSLogFileName]);
// Will be called when EurekaLog wants to 
// add additional files to packed bug report file (.elp)
procedure PackLogFile(const ACustom: Pointer; 
  AExceptionInfo: TEurekaExceptionInfo; 
  const ATempFolder: String
  AAttachedFiles: TStrings; 
  var ACallNextHandler: Boolean);
  LFileName: String;
  // Get a temporary filename 
  LFileName := ATempFolder + ExtractFileName(GTMSLogFileName);
  // Copy the log file 
  CopyFile(PChar(GTMSLogFileName), PChar(LFileName), False);
  // Pack the file to EurekaLog's crash report 
  // Initialize TMS Logging to save log to text file
  // Ask EurekaLog to add more files to .elp reports
  RegisterEventZippedFilesRequest(nil, PackLogFile);


When you receive crash report from EurekaLog - the TMS Logging log will be shown as file attach:



TMS Logging log file inside EurekaLog's crash report

Double-click log file to view in your default assigned application (text editor)



EurekaLog to TMS Logging

Alternatively, you may want to set up a reverse integration. E.g. you may want to have EurekaLog's crash information inside your TMS Logging log files. Use example below:



  VCL.TMSLogging,  // for TMS Logging routines

  EException,      // for TEurekaExceptionInfo

  EEvents;         // for RegisterEventExceptionNotify

// Tell EurekaLog to log crash info with TMS Logging
procedure LogExceptionToTMS(const ACustom: Pointer;
  AExceptionInfo: TEurekaExceptionInfo;
  var AHandle: Boolean;
  var ACallNextHandler: Boolean);
  // Log exception 
  TMSLogger.Error(Format('[%s] %s',

  // Log exception's call stack
  // You may also log other properties of AExceptionInfo
  // Or you can use routines from ESysInfo to log process and environment info
  // Of you can use BuildBugReport function to compose bug report text

  // Tell EurekaLog to log crash info with TMS Logging
  RegisterEventExceptionNotify(nil, LogExceptionToTMS);



See also:

Send feedback... Build date: 2022-03-28
Last edited: 2019-12-02
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.

Permanent link to this article: