From 7923a28c130cc2cc3813a9b1a5c83d22759d2e34 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Thu, 10 Sep 2009 14:33:46 +0000 Subject: [PATCH] line buffering git-svn-id: file:///svn/unbound/trunk@1828 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 8 +++++++- util/log.c | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/Changelog b/doc/Changelog index 9625ee794..600a787b4 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,10 +1,16 @@ +10 September 2009: Wouter + - increased MAXSYSLOGLEN so .bg key can be printed in debug output. + - use linebuffering for log-file: output, this can be significantly + faster than the previous fflush method and enable some class of + resolvers to use high verbosity (for short periods). + Not on windows, because line buffering does not work there. + 9 September 2009: Wouter - Fix bug where DNSSEC-bogus messages were marked with too high TTL. The RRsets would still expire at the normal time, but this would keep messages bogus in the cache for too long. - regression test for that bug. - documented that load_cache is meant for debugging. - - increased MAXSYSLOGLEN so .bg key can be printed in debug output. 8 September 2009: Wouter - fixup printing errors when load_cache, they were printed to the diff --git a/util/log.c b/util/log.c index ef822023b..f2ddac21f 100644 --- a/util/log.c +++ b/util/log.c @@ -129,6 +129,10 @@ log_init(const char* filename, int use_syslog, const char* chrootdir) strerror(errno)); return; } +#ifndef UB_ON_WINDOWS + /* line buffering does not work on windows */ + setvbuf(f, NULL, _IOLBF, 0); +#endif logfile = f; } @@ -217,7 +221,10 @@ log_vmsg(int pri, const char* type, #endif fprintf(logfile, "[%u] %s[%d:%x] %s: %s\n", (unsigned)now, ident, (int)getpid(), tid?*tid:0, type, message); +#ifdef UB_ON_WINDOWS + /* line buffering does not work on windows */ fflush(logfile); +#endif } /**