7.x: EurekaLog is not called when I am using TApplicationEvents component or (VCL.)AppEvnts unit
Posted by Aleksandr Alekseev on 28 November 2014 17:57
|
|
Problem: I have old code, which is working fine with previous version of EurekaLog (5.x/6.x). It does not work with EurekaLog 7. I set all options as outlined in guides, but EurekaLog is not invoked automatically for exceptions. My code uses TApplicationEvents component (from VCL.AppEvnts unit). Reason: Previous EurekaLog versions ignored whenever Application.OnException event was set or not. This behavious conflicted with default behaviour of Application object. EurekaLog 7 changes the way to work with Application.OnException event. EurekaLog 7 respects this event: if event handler is NOT set - then EurekaLog will handle exceptions automatically; if event handler is set - then EurekaLog assumes that you want to handle exceptions by yourself. TApplicationEvents component from VCL.AppEvnts unit overrides Application.OnException event handler to provide TApplicationEvents.OnException. The problem is that Delphi VCL do not have multi-cast events, thus it is not possible to have both TApplicationEvents and EurekaLog to handle TApplication.OnException. Since EurekaLog is initialized very first and TApplicationEvents is constructed inside form later - TApplicationEvents will be the last one to set TApplication.OnException handler, it wins. Solution: That depends on what you want.
Important Note: TApplicationEvents component overrides TApplication.OnException event even if you do not assign TApplicationEvents.OnException property. Also, (in some Delphi versions) VCL.AppEvnts unit overrides Application.OnException event even if no TApplicationEvents component is created. Be sure to manually remove VCL.AppEvnts unit from your application if it is not needed. Note: If you did not assign TApplicationEvents.OnException hander - then RTL will invoke Application.ShowException to show error dialog. EurekaLog can catch this call and show EurekaLog error dialog instead - but only if "low-level hooks" option is enabled. See also: | |
|