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