dovecot-2.0: mail-storage-service: Initialize logging with prope...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jul 7 17:33:00 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/b0e0d4537496
changeset: 11750:b0e0d4537496
user: Timo Sirainen <tss at iki.fi>
date: Wed Jul 07 15:32:44 2010 +0100
description:
mail-storage-service: Initialize logging with proper settings a bit earlier.
diffstat:
src/lib-storage/mail-storage-service.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diffs (65 lines):
diff -r c53fb625b07e -r b0e0d4537496 src/lib-storage/mail-storage-service.c
--- a/src/lib-storage/mail-storage-service.c Wed Jul 07 15:20:17 2010 +0100
+++ b/src/lib-storage/mail-storage-service.c Wed Jul 07 15:32:44 2010 +0100
@@ -51,6 +51,7 @@
struct master_service_settings_cache *set_cache;
unsigned int debug:1;
+ unsigned int log_initialized:1;
};
struct mail_storage_service_user {
@@ -502,16 +503,17 @@
}
static void
-mail_storage_service_init_log(struct master_service *service,
+mail_storage_service_init_log(struct mail_storage_service_ctx *ctx,
struct mail_storage_service_user *user)
{
+ ctx->log_initialized = TRUE;
T_BEGIN {
string_t *str;
str = t_str_new(256);
var_expand(str, user->user_set->mail_log_prefix,
- get_var_expand_table(service, &user->input));
- master_service_init_log(service, str_c(str));
+ get_var_expand_table(ctx->service, &user->input));
+ master_service_init_log(ctx->service, str_c(str));
} T_END;
}
@@ -586,6 +588,8 @@
/* do all the global initialization. delay initializing plugins until
we drop privileges the first time. */
if ((flags & MAIL_STORAGE_SERVICE_FLAG_NO_LOG_INIT) == 0) {
+ /* note: we may not have read any settings yet, so this logging
+ may still be going to wrong location */
master_service_init_log(service,
t_strconcat(service->name, ": ", NULL));
}
@@ -741,6 +745,14 @@
*error_r = MAIL_ERRSTR_CRITICAL_MSG;
return -1;
}
+ if ((ctx->flags & MAIL_STORAGE_SERVICE_FLAG_NO_LOG_INIT) == 0 &&
+ !ctx->log_initialized) {
+ /* initialize logging again, in case we only read the
+ settings for the first above */
+ ctx->log_initialized = TRUE;
+ master_service_init_log(ctx->service,
+ t_strconcat(ctx->service->name, ": ", NULL));
+ }
user_set = settings_parser_get_list(set_parser)[1];
if (ctx->conn == NULL)
@@ -851,7 +863,7 @@
}
if ((ctx->flags & MAIL_STORAGE_SERVICE_FLAG_NO_LOG_INIT) == 0)
- mail_storage_service_init_log(ctx->service, user);
+ mail_storage_service_init_log(ctx, user);
if ((ctx->flags & MAIL_STORAGE_SERVICE_FLAG_NO_RESTRICT_ACCESS) == 0) {
if (service_drop_privileges(user_set, user->system_groups_user,
More information about the dovecot-cvs
mailing list