extern const char *debug_extra;
-bool ctdb_logging_init(TALLOC_CTX *mem_ctx, const char *logging);
+bool ctdb_logging_init(TALLOC_CTX *mem_ctx, const char *logging,
+ const char *debug_level);
struct ctdb_log_state *ctdb_vfork_with_logging(TALLOC_CTX *mem_ctx,
struct ctdb_context *ctdb,
static struct ctdb_log_state *log_state;
/* Initialise logging */
-bool ctdb_logging_init(TALLOC_CTX *mem_ctx, const char *logging)
+bool ctdb_logging_init(TALLOC_CTX *mem_ctx, const char *logging,
+ const char *debug_level)
{
int ret;
return false;
}
- ret = logging_init(mem_ctx, logging, NULL, "ctdbd");
+ ret = logging_init(mem_ctx, logging, debug_level, "ctdbd");
if (ret != 0) {
return false;
}
int torture;
} options = {
.socket = CTDB_RUNDIR "/ctdbd.socket",
+ .debuglevel = "NOTICE",
.nlist = NULL,
.public_address_list = NULL,
.transport = "tcp",
const char **extra_argv;
poptContext pc;
struct tevent_context *ev;
- int log_level;
pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
ctdb_set_flags(ctdb, CTDB_FLAG_TORTURE);
}
- /* Set the debug level */
- if (debug_level_parse(options.debuglevel, &log_level)) {
- DEBUGLEVEL = log_level;
- } else {
- DEBUGLEVEL = DEBUG_NOTICE;
+ /* Initialize logging and set the debug level */
+ if (!ctdb_logging_init(ctdb, options.logging, options.debuglevel)) {
+ exit(1);
}
+ setenv("CTDB_LOGGING", options.logging, 1);
+ setenv("CTDB_DEBUGLEVEL", debug_level_to_string(DEBUGLEVEL), 1);
setenv("CTDB_SOCKET", options.socket, 1);
ret = ctdb_set_socketname(ctdb, options.socket);
script_log_level = options.script_log_level;
- if (!ctdb_logging_init(ctdb, options.logging)) {
- exit(1);
- }
-
DEBUG(DEBUG_NOTICE,("CTDB starting on node\n"));
gettimeofday(&ctdb->ctdbd_start_time, NULL);