[strongSwan-dev] [PATCH] Flush messages to file after logging.

Adrian-Ken Rüegsegger rueegsegger at swiss-it.ch
Thu Apr 29 10:04:25 CEST 2010


Hello Martin,

Martin Willi schrieb:
> Hi,
> 
>> When configuring strongSwan to use a file logger the log output
>> to that file is only written when charon is shutdown or the file
>> buffer is full. This change flushes the log messages on each log
>> call.
> 
> While it makes sense to flush each line in most setups, this will slow
> down gateways with very high throughput significantly. I think we should
> have a logger option to configure the flushing behavior.

Yes, this is a potential performance hog...

> We could add a "flush_line" option in the logger section (and we would
> have to fix that "dots interpreted as section delimiter"-bug in the
> logger configuration).

Making the behavior configurable/tweakable is a good idea, so adding
such an option to the logger section sounds reasonable.

> What about configuring the flush behavior with setlinebuf() instead of
> calling flush() after each line? We could do this directly in daemon.c.

Yes, this avoids doing any additional work during the log call.

Cheers,
Adrian




More information about the Dev mailing list