[Spice-devel] [PATCH spice-streaming-agent v2 2/4] Enable line buffering instead of full buffering for the log

Frediano Ziglio fziglio at redhat.com
Mon May 21 16:57:46 UTC 2018


> 
> On 05/21/2018 01:23 PM, Frediano Ziglio wrote:
> > Allows to kill the process without losing log lines
> 
> Hi Frediano,
> 
> 1. What happens when binary frames are logged ?
> 

man setlinebuf for details, but maybe more consistent to exclude this if
log_binary is true.

> 2. When the process is killed (with e.g. SIGTERM), supposedly
>     the event is caught and the file is (flushed and) closed.
> 

Yes, we handle SIGTERM signal and exit cleanly, so exit(3) is called and
file is flushed. This does not happen with other signals.

> Uri.
> 
> > 
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > ---
> >   src/spice-streaming-agent.cpp | 1 +
> >   1 file changed, 1 insertion(+)
> > 
> > diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
> > index b30e968..9ccc9da 100644
> > --- a/src/spice-streaming-agent.cpp
> > +++ b/src/spice-streaming-agent.cpp
> > @@ -489,6 +489,7 @@ int main(int argc, char* argv[])
> >                      log_filename, strerror(errno));
> >               return EXIT_FAILURE;
> >           }
> > +        setlinebuf(f_log);
> >           for (const std::string& arg: old_args) {
> >               STAT_LOG("Args: %s", arg.c_str());
> >           }
> > 
> 
> 

Frediano


More information about the Spice-devel mailing list