Subject Re: [firebird-python] Problem with tracing and FDB
Author Harriv
How fbtracemgr.exe and FB TraceManager from Upscene handle displaying the trace log in real time?

This is one of the use cases in documentation:

  1. On-demand interactive trace of some (or all) activity in some (or all) databases

    An application (which could be the fbtracemgr utility) starts a user trace session, reads its output and shows traced events to the user in real time on the screen. The user can suspend and resume the trace and, finally, stop it.


Constantly stopping and starting tracing doesn't sound feasible?



On Thu, Oct 24, 2013 at 11:35 AM, Pavel Cisar <pcisar@...> wrote:
 

Hi,

Dne 24.10.2013 10:09, Harriv napsal(a):


>
>
> I got forward:
>
> If I STOP the trace session started from FDB with fbtracemgr.exe,
> svc.readline() will return all(?) trace data stored in some buffer. So
> what I really am looking for is how get "interactive" mode?

Well, it seem that you have misunderstood how trace in Firbeird works
then :) There so no "interactive" mode. Once trace session is started,
Firebird engine accumulates trace report strings in internal buffer (if
there are any according to your trace config) until it's full (then no
more trace data is accumulated until client empties it enough for new
data via isc_service_query call). Client calls isc_service_query API
call that BLOCKs, i.e. returns only when there is any content in
engine's output buffer and trace session is active. So if there is
nothing to return, client is "frozen".

So handling trace sessions typically require two processes or threads,
one that starts the session, reads output in loop and does something
with it (prints out, store to file, whatever) and second one to end the
session. You can also terminate the trace session in "reading"
process/thread, for example using timer or other way to interrupt it and
tell it to stop fetching trace output, but that will react *only* when
it's outside of isc_service_query call, hence two processes is more
"interactive" or better "resposive".


best regards
Pavel Cisar
IBPhoenix