From 120980beba47758d7627038760382ee57f0d33ab Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 26 Feb 2009 18:51:31 +0300 Subject: * Fix logging when process is starting * Add -t option for config testing * Try to search default config in install prefix not in current directory --- src/main.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 6a170726a..9c2da60b7 100644 --- a/src/main.c +++ b/src/main.c @@ -265,9 +265,16 @@ main (int argc, char **argv, char **env) rspamd->cfg->cfg_name = memory_pool_strdup (rspamd->cfg->cfg_pool, FIXED_CONFIG_FILE); read_cmd_line (argc, argv, rspamd->cfg); + + if (cfg->config_test) { + cfg->log_level = G_LOG_LEVEL_DEBUG; + } + else { + cfg->log_level = G_LOG_LEVEL_CRITICAL; + } /* First set logger to console logger */ - cfg->log_fd = 2; + cfg->log_fd = STDERR_FILENO; g_log_set_default_handler (file_log_function, cfg); #ifndef HAVE_SETPROCTITLE @@ -287,6 +294,11 @@ main (int argc, char **argv, char **env) } fclose (f); + + if (cfg->config_test) { + fprintf (stderr, "syntax OK\n"); + return EXIT_SUCCESS; + } config_logger (rspamd, TRUE); -- cgit v1.2.3