Option added to set identifier for syslog(3) logging.

This identifier is added to each log message by syslog.
This commit is contained in:
Tobias Brunner
2012-04-20 09:26:12 +02:00
parent 7e84c4275c
commit 5895c2e948
2 changed files with 15 additions and 1 deletions
+8
View File
@@ -853,6 +853,14 @@ identifier for each IKE_SA.
Prefix each log entry with a timestamp. The option accepts a format string as
passed to
.BR strftime (3).
.TP
.BR charon.syslog.identifier
Global identifier used for an
.BR openlog (3)
call, prepended to each log message by syslog. If not configured,
.BR openlog (3)
is not called, so the value will depend on system defaults (often the program
name).
.SS Subsystems
.TP
+7 -1
View File
@@ -291,7 +291,7 @@ static void initialize_loggers(bool use_stderr, level_t levels[])
sys_logger_t *sys_logger;
file_logger_t *file_logger;
enumerator_t *enumerator;
char *facility, *filename;
char *identifier, *facility, *filename;
int loggers_defined = 0;
debug_t group;
level_t def;
@@ -299,6 +299,12 @@ static void initialize_loggers(bool use_stderr, level_t levels[])
FILE *file;
/* setup sysloggers */
identifier = lib->settings->get_str(lib->settings,
"charon.syslog.identifier", NULL);
if (identifier)
{ /* set identifier, which is prepended to each log line */
openlog(identifier, 0, 0);
}
enumerator = lib->settings->create_section_enumerator(lib->settings,
"charon.syslog");
while (enumerator->enumerate(enumerator, &facility))