FIREDAC gives annoying message

I have a REST server using Firedac with monitor enabled.

When the server (VCL at present) is closed, FIREDAC shows where the log file is. I want it gone. This is stupidity.

  1. I set the path, I know where the file is.
  2. Is this going to happen when its a service and the service is closed?

I tried this, but no luck.


procedure TDBase.DataModuleDestroy (Sender : TObject);
begin
  { Stop the annoying message about log file }
  monFD.Tracing  := False;
  monFD.FileName := ‘’;
  Flock.Free;
end;

When life gives you lemons ….

I did two things

  1. When starting the server, assigned blank to filename (this is necessary otherwise it saves it in the Temp folder).
  2. Hooked the event. Now I can customise the log and filter out unnecessary events. Code here, maybe some of it will help others.
procedure TDBase.monFDOutput
          (ASender : TFDMoniClientLinkBase;
           const AClassName, AObjName, AMessage : string);

  function Logging_This_Class : Boolean;
  begin
    Result := AClassName = 'TFDConnectionDef';
  end;

  function Logging_This_Object : Boolean;
  begin
    Result := (AObjName = 'conFD') and
              (Pos('mysql_', AMessage) = 0) and
              (Pos('. Create', AMessage) = 0) and
              (Pos('. Destroy', AMessage) = 0);

    { Filter out fetched data unless explicitly requested }
    if Result and not FLog_Qry_Results
    then Result := (Pos('Fetched', AMessage) = 0) and
                   (Pos('Column [', AMessage) = 0) and
                   (Pos('EOF', AMessage) = 0);
  end;

  function Logging_This_Command : Boolean;
  begin
    Result := (AClassName = 'TFDPhysMySQLCommand') and
              (Pos('[Command=', AMessage) > 0) and
              (Pos('Table PKey', AMessage) = 0);
  end;

  function Should_Skip_Log_Line : Boolean;
  begin
    Result := (Pos('>> Close [',     AMessage) > 0) or
              (Pos('<< Close [',     AMessage) > 0) or
              (Pos('>> Unprepare [', AMessage) > 0) or
              (Pos('<< Unprepare [', AMessage) > 0) or
              (Pos('. Destroy [',    AMessage) > 0) or
              (Pos('. Column [',     AMessage) > 0) or
              (Pos('. EOF',          AMessage) > 0);
  end;

begin
  if Logging_This_Class or Logging_This_Object or Logging_This_Command
  then if not Should_Skip_Log_Line
  then TLogger.Write (AMessage, AObjName);
end;


1 Like

I automatically assumed we would have a .contains helper that takes an array of strings … :face_without_mouth: :worried:

Well, you can. But the log is a mishmash of styles from the different components contributing to it. I preferred to see it running for a week, before deciding what to remove. Unfortunately some multi-line logs are interleaved between the components. I wanted to log time taken. Since the start and end lines are not sequential, it requires a dictionary storage to track them. I left that for later - I will see what the new size of logs is over the next week.

1 Like

I just meant that I don’t think we DO have a built-in helper for

.Contains( [‘EOF’, ‘Destroy’, ‘Cancel’, … ] )

(maybe in Spring4D ‘tho)

1 Like