Products:

- SvCom
- Shell+
- PerfUtils

Download:

- SvCom
- Shell+
- PerfUtils

Ordering:

- Order now

Support:

- Contact directly


Embarcadero Technology Partner

 
    Step 2. EventLog recording: pure API step-by-step  

It is easy to write message into EventLog. You call RegisterEventSource to open EventLog, then you call ReportEvent to write message and finally you close EventLog access by DeregisterEventSource. The mesage will be stored in the EventLog but it will look like this one:

simple EventLog record

First of all you see a long warning text: "The description .. can not be found... see Help... see Support" and so on. The useful part of this message follows at the end of this text and contains a few words only: "Extended handler is registered".

The other problem is that you see Source of the event (Termit.Shipping.Cher in this example) but you can not filter by this value because there are no such value in the filter dropdown list. Category value can not be used in foter too because EvetnLog viwer has no categories for this event source.

Take a look on another EventLog records set. It can be filtered:

Filtered EventLog view

And the record itself is well-formatted:

Advanced EventLog record

Several steps should be done to get this result:

  1. Prepare formatting strings. You should supply separate string for every EventID. Every string works like Delphi's FormatString parameter in the Format() call. The only difference is that Delphi's FormatString support different placeholder like %s, %d, %f and so on while EventLog formatting strings considers all parameters as strings and all placeholders are enumeated: %1, %2, %3 and so on.
  2. These formatted strings should be saved in .rc file in StringTable format.
  3. This. rc should be compiled and attached to the .dll file
  4. This .dll should be registered in the registry on user machine with bunch of additional parameters such as Event Source name, count of categories and so on. By the way, every category should be saved in .rc string table too.
  5. This .dll should be deployed with the application so the registration process should be automated somehow.
  6. EventIDs should be used when ReportEvent is called. It means that separate unit with EventIDs declarations should be used.

Could these steps be done? Yes, sure, but it is not what is called "rapid development". There really rapid way follows...

 

<< . index . 1 . 2 . 3 . >>
SvCom links:

- Overview
- Download
- Purchase
- FAQ
- Tutorial
- What's new
- For registered users
- Support

Copyright:

© 1998-2003. Alexey Dynnikov
© 2003-2016. ALDYN Software
© Design: Adonis i-cafe.