TCustomDaemonApplication: ugly texts in event log
Original Reporter info from Mantis: Mahris
-
Reporter name: Maris Janis Vasilevskis
Original Reporter info from Mantis: Mahris
- Reporter name: Maris Janis Vasilevskis
Description:
Sorry, still not found a way to write a correct version. I use 2.7.1.
In Event log, I see from my service things like:
The description for Event ID 1001 from source project1 cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
Daemon displ daemon1 current status: Stopped
Steps to reproduce:
Create a service based on TCustomDaemonApplication.
Install, start, view Event log.
Additional information:
To fix this problem, I had to create 3 files overriding TCustomDaemonApplication and TEventLog, replacing TLazDaemonApplication. Too much work for such a small thing.
I you do not propose more important changes, should be nice to add two events: OnGetEventLog and OnUnRegisterMessageFile.
More details.
In GetEventLog, FEventLog.RegisterMessageFile('') issued. It means that event source will be named from executable. And the same executable will be used to extract resource strings from message ID.
About second - I definitely do not know a simple way to make in FP resource strings with fixed numbers (same in Delphi).
About first - I have a system of multiple applications which should use the same source name and the same message file.
OnGetEventLog event could solve my problems avoiding need of 3 overridden classes.
And, of course, EventLog.RegisterMessageFile(''); should be removed from TCustomDaemonApplication.InstallDaemons. It duplicates job already done in GetEventLog.
TCustomDaemonApplication.UnInstallDaemons contains EventLog.UnRegisterMessageFile. As my message file is shared by multiple applications, I do not wish to uninstall it in any single application, I do it in setup.
OnUnRegisterMessageFile can solve this problem.
Mantis conversion info:
- Mantis ID: 24390
- OS: 2008 SP1 64 bit
- OS Build: 7601
- Build: SVN 40963
- Platform: windows
- Version: 2.6.2
- Fixed in version: 3.0.0
- Fixed in revision: 24457 (#bef9b11d)
- Target version: 3.0.0