aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-02-26 18:51:31 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-02-26 18:51:31 +0300
commit120980beba47758d7627038760382ee57f0d33ab (patch)
tree2213a14df2f90bf79a0a4f1a30be27a30b2a9a7a /src/main.c
parentcfb5348f75790ef694edd5a9c131890eeceec204 (diff)
downloadrspamd-120980beba47758d7627038760382ee57f0d33ab.tar.gz
rspamd-120980beba47758d7627038760382ee57f0d33ab.zip
* Fix logging when process is starting
* Add -t option for config testing * Try to search default config in install prefix not in current directory
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c14
1 files changed, 13 insertions, 1 deletions
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);