Hello,
I'm trying to set a own instance in EventLog property of all apps like TCustomHttpApplication, TCustomCGIApplication and TCustomFCGIApplication, but, no success.
To get the error, try:
TMyHttpApplication = class(TCustomHttpApplication) ...
constructor TMyHttpApplication.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
EventLog := TMyEventLog.Create(Self);
...I saw this code:
TCustomWebApplication = Class(TCustomApplication)
...
Public
Property EventLog: TEventLog read GetEventLog;Seems good changing it to:
Property EventLog: TEventLog read GetEventLog write FEventLog;So the code below will get my own instance instead of default instance:
function TCustomWebApplication.GetEventLog: TEventLog;
begin
if not assigned(FEventLog) then
begin
FEventLog := TEventLog.Create(Nil);
FEventLog.Name:=Self.Name+'Logger';
FEventLog.Identification:=Title;
FEventLog.RegisterMessageFile(ParamStr(0));
FEventLog.LogType:=ltSystem;
FEventLog.Active:=True;
end;
Result := FEventLog;
end;Thank you!
P.S.: Lazarus 1.2.2 r44758 FPC 2.6.4 i386-win32-win32/win64
