static int logging_init (glusterfs_ctx_t *ctx) { cmd_args_t *cmd_args = NULL; int ret = 0; cmd_args = &ctx->cmd_args; if (cmd_args->log_file == NULL) { ret = set_log_file_path (cmd_args); if (ret == -1) { fprintf (stderr, "failed to set the log file path.. " "exiting\n"); return -1; } } if (gf_log_init (cmd_args->log_file) == -1) { fprintf (stderr, "failed to open logfile %s. exiting\n", cmd_args->log_file); return -1; } gf_log_set_loglevel (cmd_args->log_level); return 0; }
static int logging_init (glusterfs_ctx_t *ctx) { cmd_args_t *cmd_args = NULL; cmd_args = &ctx->cmd_args; if (gf_log_init (cmd_args->log_file) == -1) { fprintf (stderr, "ERROR: failed to open logfile %s\n", cmd_args->log_file); return -1; } gf_log_set_loglevel (cmd_args->log_level); return 0; }
static int logging_init (glusterfs_ctx_t *ctx, struct cli_state *state) { char *log_file = state->log_file ? state->log_file : DEFAULT_CLI_LOG_FILE_DIRECTORY "/cli.log"; if (gf_log_init (ctx, log_file) == -1) { fprintf (stderr, "ERROR: failed to open logfile %s\n", log_file); return -1; } /* CLI should not have something to DEBUG after the release, hence defaulting to INFO loglevel */ gf_log_set_loglevel ((state->log_level == -1) ? GF_LOG_INFO : state->log_level); return 0; }
static int logging_init (void) { glusterfs_ctx_t *ctx; char log_file[PATH_MAX]; int ret = -1; ctx = glusterfs_ctx_new (); if (!ctx) { fprintf (stderr, "glusterfs_ctx_new failed\n"); goto out; } ret = glusterfs_globals_init (ctx); if (ret) { fprintf (stderr, "glusterfs_globals_init failed\n"); goto out; } THIS->ctx = ctx; xlator_mem_acct_init (THIS, gf_common_mt_end); snprintf (log_file, PATH_MAX, "%s/umountd.log", DEFAULT_LOG_FILE_DIRECTORY); ret = gf_log_init (ctx, log_file, "umountd"); if (ret) { fprintf (stderr, "gf_log_init failed\n"); goto out; } if (signal (SIGHUP, *log_rotate) == SIG_ERR) { gf_log ("umountd", GF_LOG_ERROR, "signal () failed"); goto out; } ret = 0; out: return ret; }