Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

Integration with Eurekalog when file is used as connection


#1

When using file as connection in SI, Eurekalog cannot attach the file because its in use by SI.
It works of course when using memory and flushing it to file, then attaching it.
But our applications is already quite memory consuming, and I would prefer to log to file. Is there a way to close the handle to the file, so the file is not is use any longer and I can attach it?


#2

Hello!

Yes, you would just need to set Si.Enabled := False before attaching the file and all connections and handles are closed.

Regards,
Tobias


#3

That was the first I tried, but still, “file in use”.
Will have to try again, maybe I did something wrong (I doubt I did).
I did use si.enabled:=false; in the eurekalogs onAttachedFileRequest, then added the log to the list, but it could not be attached due to file in use issues.


#4

Setting Si.Enabled to False should actually work, because all connections are forced to disconnect which means, in case of logging to a file, that the file handles are closed.

That said, there’s also a second option. SmartInspect creates/opens log files in SHARED READ mode so that the Console can load log files while your application still writes to them. You could write a function which opens the SmartInspect log in shared read mode and copies it to a temporary file and attach the temp file to Eurekalog. This also has the advantage that you wouldn’t need to stop logging just for attaching the log file.

Regards,
Tobias