Mercurial > dovecot > original-hg > dovecot-1.2
changeset 35:b420373f88f6 HEAD
Added log_path and log_timestamp settings to config file. Removed -l command
line option for imap-master.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 27 Aug 2002 00:03:43 +0300 |
parents | a3d77e73f99b |
children | 2d6f60efa704 |
files | dovecot-example.conf src/auth/main.c src/imap/main.c src/login/main.c src/master/main.c src/master/settings.c src/master/settings.h |
diffstat | 7 files changed, 34 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/dovecot-example.conf Mon Aug 26 23:49:05 2002 +0300 +++ b/dovecot-example.conf Tue Aug 27 00:03:43 2002 +0300 @@ -26,6 +26,13 @@ # SSL/TLS is used (LOGINDISABLED capability) #disable_plaintext_auth = no +# Use this logfile instead of syslog() +#log_path = + +# Prefix for each line written to log file. % codes are in strftime(3) +# format. Note the extra space at the end of line. +#log_timestamp = %b %d %H:%M:%S + ## ## Login process ##
--- a/src/auth/main.c Mon Aug 26 23:49:05 2002 +0300 +++ b/src/auth/main.c Tue Aug 27 00:03:43 2002 +0300 @@ -53,7 +53,7 @@ } else { /* log failures into specified log file */ i_set_failure_file(logfile, "imap-auth"); - i_set_failure_timestamp_format(DEFAULT_FAILURE_STAMP_FORMAT); + i_set_failure_timestamp_format(getenv("IMAP_LOGSTAMP")); } restrict_access_by_env();
--- a/src/imap/main.c Mon Aug 26 23:49:05 2002 +0300 +++ b/src/imap/main.c Tue Aug 27 00:03:43 2002 +0300 @@ -30,7 +30,7 @@ if (logfile != NULL) { /* log failures into specified log file */ i_set_failure_file(logfile, log_prefix); - i_set_failure_timestamp_format(DEFAULT_FAILURE_STAMP_FORMAT); + i_set_failure_timestamp_format(getenv("IMAP_LOGSTAMP")); } else if (use_syslog) { /* prefix with imapd(user) */ openlog(log_prefix, 0, LOG_MAIL);
--- a/src/login/main.c Mon Aug 26 23:49:05 2002 +0300 +++ b/src/login/main.c Tue Aug 27 00:03:43 2002 +0300 @@ -75,7 +75,7 @@ } else { /* log failures into specified log file */ i_set_failure_file(logfile, "imap-login"); - i_set_failure_timestamp_format(DEFAULT_FAILURE_STAMP_FORMAT); + i_set_failure_timestamp_format(getenv("IMAP_LOGSTAMP")); } disable_plaintext_auth = getenv("DISABLE_PLAINTEXT_AUTH") != NULL;
--- a/src/master/main.c Mon Aug 26 23:49:05 2002 +0300 +++ b/src/master/main.c Tue Aug 27 00:03:43 2002 +0300 @@ -22,7 +22,6 @@ "imap" }; -static const char *logfile = NULL; static IOLoop ioloop; static Timeout to_children; @@ -50,8 +49,14 @@ *environ = NULL; /* set the failure log */ - if (logfile != NULL) - putenv((char *) t_strconcat("IMAP_LOGFILE=", logfile, NULL)); + if (set_log_path != NULL) { + putenv((char *) t_strconcat("IMAP_LOGFILE=", + set_log_path, NULL)); + } + if (set_log_timestamp != NULL) { + putenv((char *) t_strconcat("IMAP_LOGSTAMP=", + set_log_timestamp, NULL)); + } (void)close(null_fd); (void)close(imap_fd); @@ -148,19 +153,14 @@ } } -static void main_init(const char *logfile) +static void main_init() { lib_init_signals(sig_quit); /* deny file access from everyone else except owner */ (void)umask(0077); - if (logfile == NULL) - logfile = getenv("IMAP_LOGFILE"); - - if (logfile == NULL) { - /* open the syslog immediately so chroot() won't - break logging */ + if (set_log_path == NULL) { openlog("imap-master", LOG_NDELAY, LOG_MAIL); i_set_panic_handler(i_syslog_panic_handler); @@ -169,8 +169,8 @@ i_set_warning_handler(i_syslog_warning_handler); } else { /* log failures into specified log file */ - i_set_failure_file(logfile, "imap-master"); - i_set_failure_timestamp_format(DEFAULT_FAILURE_STAMP_FORMAT); + i_set_failure_file(set_log_path, "imap-master"); + i_set_failure_timestamp_format(set_log_timestamp); } pids = hash_create(default_pool, 128, NULL, NULL); @@ -228,11 +228,6 @@ i++; if (i == argc) i_fatal("Missing config file argument"); configfile = argv[i]; - } else if (strcmp(argv[i], "-l") == 0) { - /* log file */ - i++; - if (i == argc) i_fatal("Missing log file argument"); - logfile = argv[i]; } else { i_fatal("Unknown argument: %s", argv[1]); } @@ -247,7 +242,7 @@ ioloop = io_loop_create(); - main_init(logfile); + main_init(); io_loop_run(ioloop); main_deinit();
--- a/src/master/settings.c Mon Aug 26 23:49:05 2002 +0300 +++ b/src/master/settings.c Tue Aug 27 00:03:43 2002 +0300 @@ -23,6 +23,9 @@ } Setting; static Setting settings[] = { + { "log_path", SET_STR, &set_log_path }, + { "log_timestamp", SET_STR, &set_log_timestamp }, + { "login_executable", SET_STR, &set_login_executable }, { "login_user", SET_STR, &set_login_user }, { "login_dir", SET_STR, &set_login_dir }, @@ -54,6 +57,10 @@ { NULL, 0, NULL } }; +/* common */ +char *set_log_path = NULL; +char *set_log_timestamp = DEFAULT_FAILURE_STAMP_FORMAT; + /* login */ char *set_login_executable = PKG_LIBDIR "/imap-login"; char *set_login_user = "imapd";
--- a/src/master/settings.h Mon Aug 26 23:49:05 2002 +0300 +++ b/src/master/settings.h Tue Aug 27 00:03:43 2002 +0300 @@ -1,6 +1,10 @@ #ifndef __SETTINGS_H #define __SETTINGS_H +/* common */ +extern char *set_log_path; +extern char *set_log_timestamp; + /* login */ extern char *set_login_executable; extern char *set_login_user;