Search code examples
delphimonitoringtracefiredacdelphi-10.2-tokyo

TFDMoniFlatFileClientLink irregularly does not trace to file


I have a TFDMoniFlatFileClientLink on a form, filename set to d:\temp\monitor.txt, tracing=true, TFDConnection.Params.MonitorBy=mbFlatFile. This sometimes works and sometimes does not trace anything. No file gets created.

Tested with Win7 32-bit app, with design time TFDConnection to either FireBird or Oracle. Delphi Tokyo 10.2.1

What is going on?


Solution

  • This was a really weird bug:

    It turns out that the TFDMoniFlatFileClientLink remembers the filename when removed and placed back, then does not trace.

    To reproduce:

    Remove the TFDMoniFlatFileClientLink, optionally save the project, place a TFDMoniFlatFileClientLink on the form again, set tracing=true. It has magically remembered filename d:\temp\monitor.txt (where?), then either does not trace or traces to C:\Users\username\AppData\Local\Temp\traceX.txt.

    Only when you change the filename does it successfully trace again.*

    Similar weird things happen with TFDMoniRemoteFileClientLink, it very often does not create trace output for FDMonitor to pick up. I have not investigated the exact conditions under which this happens.

    I found this in a test app after tracing the following issue, possibly related:**

    A design time TFDConnection gets its parameters filled at run-time. I executed TFDConnection.Params.Add('MonitorBy=mbFlatFile') but the app did not trace. I verified that MonitorByInitial=true at run-time. Params.Add('MonitorBy=mbRemote') also failed.
    A TFDMoniFlatFileClientLink and TFDMoniRemoteClientLink were placed on the datamodule at design time.

    Reported in Embarcadero Quality Portal under issue RSP-19554

    * Even if you change it to the same file name. If you do that at run-time you have to set Tracing=false/true around the FileName assignment.

    ** Mmm, not related. Reported as RSP-19559