[fpc-pascal] EventLog and error "No member is provided to access property"
silvioprog
silvioprog at gmail.com
Tue May 13 19:40:17 CEST 2014
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
--
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140513/f8d41644/attachment.html>
More information about the fpc-pascal
mailing list