diff options
Diffstat (limited to 'src/util/server.c')
-rw-r--r-- | src/util/server.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/util/server.c b/src/util/server.c index d00db3108..51934f8ba 100644 --- a/src/util/server.c +++ b/src/util/server.c @@ -370,13 +370,47 @@ static void te_server_hup(struct tevent_context *ev, DEBUG(SSSDBG_CRIT_FAILURE, "Received SIGHUP. Rotating logfiles.\n"); - ret = monitor_common_rotate_logs(lctx->confdb, lctx->confdb_path); + ret = server_common_rotate_logs(lctx->confdb, lctx->confdb_path); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "Could not reopen log file [%s]\n", strerror(ret)); } } +errno_t server_common_rotate_logs(struct confdb_ctx *confdb, + const char *conf_path) +{ + errno_t ret; + int old_debug_level = debug_level; + + ret = rotate_debug_files(); + if (ret) { + sss_log(SSS_LOG_ALERT, "Could not rotate debug files! [%d][%s]\n", + ret, strerror(ret)); + return ret; + } + + /* Get new debug level from the confdb */ + ret = confdb_get_int(confdb, conf_path, + CONFDB_SERVICE_DEBUG_LEVEL, + old_debug_level, + &debug_level); + if (ret != EOK) { + DEBUG(SSSDBG_FATAL_FAILURE, "Error reading from confdb (%d) [%s]\n", + ret, strerror(ret)); + /* Try to proceed with the old value */ + debug_level = old_debug_level; + } + + if (debug_level != old_debug_level) { + DEBUG(SSSDBG_FATAL_FAILURE, + "Debug level changed to %#.4x\n", debug_level); + debug_level = debug_convert_old_level(debug_level); + } + + return EOK; +} + int server_setup(const char *name, int flags, const char *conf_entry, struct main_context **main_ctx) |