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

Access to the async queue


Hi all

Because I need to save my log file into a database I want to wait until all data is written before saving and then delete the file from hard disk.

I use the backlog and async feature for the file protocol.

Now I have the problem, that I don’t know how many pending messages are in the system and when all messages are written.

Can anyone help me to solve my problem?




Hello Lothar,

Before you want to write the log file to the database, you can disable the SmartInspect object (Si.Enabled = false) and all pending messages will be written to the log file. After Si.Enabled has returned, the log file has been closed and can safely be written to the database and deleted afterwards.

Alternatively to writing the entire log to the database and using the intermediate log file, you could also write a small custom protocol for writing the log entries directly to the database. We have an article in our article section which explains how to do this and a custom protocol implementation for Sqlite as a concrete example:

By the way, the async option is mainly intended to be used with the TCP protocol and less useful with log files. Enabling asynchronous logging introduces a certain overhead and log files are so fast that enabling the option may even hurt the logging performance a bit.


I don’t want to write messages to the database directly, because the database is on another server. So I write log files and after all finished I move them into the database.

Thanks for the trick with disabling the logger. I’ll try it. :slight_smile: