From: Ralph Boehme Date: Wed, 12 Dec 2018 12:11:26 +0000 (+0100) Subject: debug: add support for per debug-class logfiles X-Git-Tag: tdb-1.3.17~205 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=249bdd9378306c146dca0eec6711e2c6b8eae29a;p=thirdparty%2Fsamba.git debug: add support for per debug-class logfiles This adds support for per debug-class logfiles to the function parsing the "log level" option. The enhanced syntax is: log level = CLASS:LEVEL[@PATH] [CLASS:LEVEL[@PATH] ... ] Eg log level = full_audit:1@/var/log/audit.logfile While the option is already parsed and stored in in the dbgc_config[] array, the feature is still effectively disabled, as reopen_logs_internal() still doesn't open the per debug-class logfiles. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/lib/util/debug.c b/lib/util/debug.c index 780ce9a26c2..c315222a9bb 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -810,6 +810,7 @@ static void debug_dump_status(int level) static bool debug_parse_param(char *param) { char *class_name; + char *class_file = NULL; char *class_level; char *saveptr = NULL; int ndx; @@ -819,11 +820,13 @@ static bool debug_parse_param(char *param) return false; } - class_level = strtok_r(NULL, "\0", &saveptr); + class_level = strtok_r(NULL, "@\0", &saveptr); if (class_level == NULL) { return false; } + class_file = strtok_r(NULL, "\0", &saveptr); + ndx = debug_lookup_classname(class_name); if (ndx == -1) { return false; @@ -831,6 +834,16 @@ static bool debug_parse_param(char *param) dbgc_config[ndx].loglevel = atoi(class_level); + if (class_file == NULL) { + return true; + } + + TALLOC_FREE(dbgc_config[ndx].logfile); + + dbgc_config[ndx].logfile = talloc_strdup(NULL, class_file); + if (dbgc_config[ndx].logfile == NULL) { + return false; + } return true; }