summaryrefslogtreecommitdiffstats
path: root/server/util/server.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-09-25 13:20:13 +0200
committerStephen Gallagher <sgallagh@redhat.com>2009-09-25 10:19:56 -0400
commit05315b44feaa9819e62f18477f2c6d20914eb7ce (patch)
tree82e28792e306de9e461ea9dde5203d6a3a9de7fa /server/util/server.c
parent6cec00b7fe2aed71b8df21d2a0d97df8b448cc85 (diff)
downloadsssd-05315b44feaa9819e62f18477f2c6d20914eb7ce.tar.gz
sssd-05315b44feaa9819e62f18477f2c6d20914eb7ce.tar.xz
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/util/server.c')
-rw-r--r--server/util/server.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/server/util/server.c b/server/util/server.c
index a8c502409..e8daf87cb 100644
--- a/server/util/server.c
+++ b/server/util/server.c
@@ -298,6 +298,7 @@ int server_setup(const char *name, int flags,
char *conf_db;
int ret = EOK;
bool dt;
+ bool dl;
debug_prg_name = strdup(name);
if (!debug_prg_name) {
@@ -352,7 +353,6 @@ int server_setup(const char *name, int flags,
DEBUG(0,("Out of memory, aborting!\n"));
return ENOMEM;
}
- DEBUG(3, ("CONFDB: %s\n", conf_db));
ret = confdb_init(ctx, &ctx->confdb_ctx, conf_db);
if (ret != EOK) {
@@ -382,6 +382,30 @@ int server_setup(const char *name, int flags,
}
if (dt) debug_timestamps = 1;
+ /* same for debug to file */
+ dl = (debug_to_file != 0);
+ ret = confdb_get_bool(ctx->confdb_ctx, ctx, conf_entry,
+ CONFDB_SERVICE_DEBUG_TO_FILES,
+ dl, &dl);
+ if (ret != EOK) {
+ DEBUG(0, ("Error reading from confdb (%d) [%s]\n",
+ ret, strerror(ret)));
+ return ret;
+ }
+ if (dl) debug_to_file = 1;
+
+ /* open log file if told so */
+ if (debug_to_file) {
+ ret = open_debug_file();
+ if (ret != EOK) {
+ DEBUG(0, ("Error setting up logging (%d) [%s]\n",
+ ret, strerror(ret)));
+ return ret;
+ }
+ }
+
+ DEBUG(3, ("CONFDB: %s\n", conf_db));
+
if (flags & FLAGS_INTERACTIVE) {
/* terminate when stdin goes away */
stdin_event_flags = TEVENT_FD_READ;