[strongSwan-dev] [PATCH] Add 'flush_line' option to filelog section.
Adrian-Ken Rueegsegger
rueegsegger at swiss-it.ch
Sun May 2 14:37:16 CEST 2010
The new boolean 'flush_line' option in the filelog section of
strongswan.conf specifies if log messages should be flushed to the given
file for each new line.
Note: Flushing is now enabled by default. If file logging is enabled and
throughput is high this can lead to performance degradation. In this case
the old behavior can be restored by disabling flush_line explicitly.
---
v2: - Make behavior configurable via flush_line option
- use setlinebuf instead of fflush
src/libcharon/daemon.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/libcharon/daemon.c b/src/libcharon/daemon.c
index 11c94be..116e9aa 100644
--- a/src/libcharon/daemon.c
+++ b/src/libcharon/daemon.c
@@ -194,6 +194,7 @@ static void initialize_loggers(private_daemon_t *this, bool use_stderr,
debug_t group;
level_t def;
bool append;
+ bool flush_line;
FILE *file;
/* setup sysloggers */
@@ -254,7 +255,15 @@ static void initialize_loggers(private_daemon_t *this, bool use_stderr,
filename, strerror(errno));
continue;
}
+
+ flush_line = lib->settings->get_bool(lib->settings,
+ "charon.filelog.%s.flush_line", TRUE, filename);
+ if (flush_line)
+ {
+ setlinebuf(file);
+ }
}
+
file_logger = file_logger_create(file);
def = lib->settings->get_int(lib->settings,
"charon.filelog.%s.default", 1, filename);
--
1.6.5
More information about the Dev
mailing list