You can use a TEurekaLogEvents component. It is very similar to the standard TApplicationEvents component.
Warning: Event handlers registered via TEurekaLogEvents component will be active only when corresponding form is live (created). Such handlers will not be called before form is created or after it was destroyed. For this reason you may want to register your event handlers via code. For example, it would be a bad idea to use TEurekaLogEvents component for implementing your error dialog, because your dialog will not be displayed for exceptions outside form (e.g. initialization/finalization exceptions, as well as exceptions in form's constructor).
Just drop the TEurekaLogEvents component on the form:
Then switch to "Events" tab and create / assign the desired handler:
You can see a description of each available event here. You are usually interested in OnExceptionNotify event.
|•||Dropping TEurekaLogEvents component on your form(s) is not enough to enable EurekaLog for your application! You have to configure EurekaLog.|
|•||If you are going to change EurekaLog's settings from your event handler - be sure to alter local options (AExceptionInfo.Options), not global options (CurrentEurekaLogOptions). See this article for explanation.|
|•||If you enable EurekaLog for background threads - your event handlers will be called in the context of corresponding thread. E.g. if exception happens in a background thread - your event handlers will be called by this thread. Therefore, you need to use some sort of synchronization if you are going to access global data. For example, if you want to access forms (VCL) in your event handlers - then you must marshal these calls to the main thread (for example, by using SendMessage, TThread.Synchronize, or TThread.Queue).|
Build date: 2021-10-15
Last edited: 2020-01-08
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: https://www.eurekalog.com/help/eurekalog/how_to_add_event_hander.php