Redirect message in terminal to a log file.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Redirect message in terminal to a log file.

fredvs
Administrator
Hello.

PortAudio and Mpg123 libraries produces lot of debug message if you run a application via terminal.

Here how to do to redirect all those messages to a log file:

program mytmessage_redirect;
  uses   ...,  Classes, BaseUnix;
      ...
     var
        fs: TFileStream;
      begin
         fs := TFileStream.Create('error.log', fmOpenReadWrite or fmCreate);
         FpDup2(fs.Handle, StdErrorHandle);
          ...
         Application.run;
         fs.free;
      end.