diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2009-09-25 13:20:13 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-09-25 10:19:56 -0400 |
commit | 05315b44feaa9819e62f18477f2c6d20914eb7ce (patch) | |
tree | 82e28792e306de9e461ea9dde5203d6a3a9de7fa /server/monitor | |
parent | 6cec00b7fe2aed71b8df21d2a0d97df8b448cc85 (diff) | |
download | sssd-05315b44feaa9819e62f18477f2c6d20914eb7ce.tar.gz sssd-05315b44feaa9819e62f18477f2c6d20914eb7ce.tar.bz2 sssd-05315b44feaa9819e62f18477f2c6d20914eb7ce.zip |
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.
Diffstat (limited to 'server/monitor')
-rw-r--r-- | server/monitor/monitor.c | 18 |
1 files changed, 15 insertions, 3 deletions
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; |