From 05315b44feaa9819e62f18477f2c6d20914eb7ce Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Fri, 25 Sep 2009 13:20:13 +0200 Subject: Send debug messages to logfile Introduces a new option --debug-to-files which makes SSSD output its debug information to a file instead of stderr, which is still the default. Also introduces a new confdb option debug_to_files which does the same, but can be specified per-service in the config file. The logfiles are stored in /var/log/sssd by default. Changes the initscript to log to files by default. --- server/monitor/monitor.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'server/monitor') diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c index b78a768c..9972397e 100644 --- a/server/monitor/monitor.c +++ b/server/monitor/monitor.c @@ -938,11 +938,13 @@ static int get_service_config(struct mt_ctx *ctx, const char *name, } if (!svc->command) { - svc->command = talloc_asprintf(svc, "%s/sssd_%s -d %d%s", + svc->command = talloc_asprintf(svc, "%s/sssd_%s -d %d%s%s", SSSD_LIBEXEC_PATH, svc->name, debug_level, (debug_timestamps? - " --debug-timestamps":"")); + " --debug-timestamps":""), + (debug_to_file ? + " --debug-to-files":"")); if (!svc->command) { talloc_free(svc); return ENOMEM; @@ -1053,9 +1055,10 @@ static int get_provider_config(struct mt_ctx *ctx, const char *name, /* if there are no custom commands, build a default one */ if (!svc->command) { svc->command = talloc_asprintf(svc, - "%s/sssd_be -d %d%s --domain %s", + "%s/sssd_be -d %d%s%s --domain %s", SSSD_LIBEXEC_PATH, debug_level, (debug_timestamps?" --debug-timestamps":""), + (debug_to_file?" --debug-to-files":""), svc->name); if (!svc->command) { talloc_free(svc); @@ -2427,6 +2430,15 @@ int main(int argc, const char *argv[]) /* we want a pid file check */ flags |= FLAGS_PID_FILE; + /* Open before server_setup() does to have logging + * during configuration checking */ + if (debug_to_file) { + ret = open_debug_file(); + if (ret) { + return 7; + } + } + /* Parse config file, fail if cannot be done */ ret = load_configuration(tmp_ctx, config_file, &monitor); if (ret != EOK) return 4; -- cgit