Hi, I'm using FPC 2.2.4 with Lazarus.
The unit eventlog is great for logging events. SO i use it. My question is how to change the default location for the filename for Linxu ssytem which is harcoded in the code. The documentation for TEventLog.FileName wrote: " FileName is the name of the log file used to log messages (...). The file is then located in the "/tmp" directory on unix-like systems, or in the application directory for Dos/Windows like systems Line 56 to 60 from eventlog.inc (fpc\2.2.4\source\packages\fcl-base\src\unix) Function TEventLog.DefaultFileName : String; begin Result:='/tmp/'+ChangeFileExt(ExtractFileName(Paramstr(0)),'.log'); end; I can of course change the function code like Windows to have the log in the same directory thtat the application.: Line 18 to 22 from eventlog.inc (fpc\2.2.4\source\packages\fcl-base\src\windows) Function TEventLog.DefaultFileName : String; begin Result:=ChangeFileExt(Paramstr(0),'.log'); end; Could you indicate a nice solution to indicate log file location in using the unit eventlog without change fpc code? FYI: this is the code i use: program project1; {$mode objfpc}{$H+} uses Sysutils, eventlog, {$IFDEF UNIX} BaseUnix,{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} Classes { you can add units after this }; {$IFDEF WINDOWS}{$R project1.rc}{$ENDIF} var A : TEventLog; begin A := TEventLog.Create(nil); A.LogType := ltFile; A.FileName := 'log'; A.Active := True; A.Info('Program started.'); A.Info('Info from A.'); A.Warning('Info from A.'); A.Error('Info from A.'); A.Debug('Info from A.'); A.Info('Program stopped.'); FreeAndNil(A); end. Thanks for your advice. Regards, Phoebus _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal