From: Timo Sirainen Date: Mon, 20 Apr 2020 18:41:39 +0000 (+0300) Subject: global: Use master_service_init_log_with_prefix() where explicit prefix is wanted X-Git-Tag: 2.3.11.2~183 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=550bac3d48d6129c0d591c7cc157ccbd906b273b;p=thirdparty%2Fdovecot%2Fcore.git global: Use master_service_init_log_with_prefix() where explicit prefix is wanted --- diff --git a/src/director/main.c b/src/director/main.c index b77329b091..0dc8db98e3 100644 --- a/src/director/main.c +++ b/src/director/main.c @@ -351,7 +351,7 @@ int main(int argc, char *argv[]) if (director->test_port != 0) { /* we're testing, possibly writing to same log file. make it clear which director we are. */ - master_service_init_log(master_service, + master_service_init_log_with_prefix(master_service, t_strdup_printf("director(%s): ", net_ip2addr(&director->self_ip))); } diff --git a/src/lib-master/master-service.c b/src/lib-master/master-service.c index 07c4a9c4b5..ee00d895ef 100644 --- a/src/lib-master/master-service.c +++ b/src/lib-master/master-service.c @@ -523,7 +523,7 @@ void master_service_init_log_with_prefix(struct master_service *service, void master_service_init_log_with_pid(struct master_service *service) { - master_service_init_log(service, t_strdup_printf( + master_service_init_log_with_prefix(service, t_strdup_printf( "%s(%s): ", service->configured_name, my_pid)); } diff --git a/src/lib-storage/mail-storage-service.c b/src/lib-storage/mail-storage-service.c index 7ffa21145a..e3d581ba7c 100644 --- a/src/lib-storage/mail-storage-service.c +++ b/src/lib-storage/mail-storage-service.c @@ -899,7 +899,7 @@ mail_storage_service_init_log(struct mail_storage_service_ctx *ctx, user->log_prefix = p_strdup(user->pool, str_c(str)); } T_END; - master_service_init_log(ctx->service, user->log_prefix); + master_service_init_log_with_prefix(ctx->service, user->log_prefix); /* replace the whole log prefix with mail_log_prefix */ event_replace_log_prefix(user->event, user->log_prefix); @@ -991,9 +991,11 @@ mail_storage_service_init(struct master_service *service, 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 */ + const char *configured_name = + master_service_get_configured_name(service); ctx->default_log_prefix = - p_strconcat(pool, service->name, ": ", NULL); - master_service_init_log(service, ctx->default_log_prefix); + p_strconcat(pool, configured_name, ": ", NULL); + master_service_init_log_with_prefix(service, ctx->default_log_prefix); } dict_drivers_register_builtin(); if (storage_service_global == NULL) @@ -1259,9 +1261,11 @@ mail_storage_service_lookup_real(struct mail_storage_service_ctx *ctx, !ctx->log_initialized) { /* initialize logging again, in case we only read the settings for the first above */ + const char *configured_name = + master_service_get_configured_name(ctx->service); ctx->log_initialized = TRUE; - master_service_init_log(ctx->service, - t_strconcat(ctx->service->name, ": ", NULL)); + master_service_init_log_with_prefix(ctx->service, + t_strconcat(configured_name, ": ", NULL)); update_log_prefix = TRUE; } sets = master_service_settings_parser_get_others(master_service, diff --git a/src/log/main.c b/src/log/main.c index 98c698deba..a6ac950a67 100644 --- a/src/log/main.c +++ b/src/log/main.c @@ -21,7 +21,7 @@ static void sig_reopen_logs(const siginfo_t *si ATTR_UNUSED, void *context ATTR_UNUSED) { master_service->log_initialized = FALSE; - master_service_init_log(master_service, global_log_prefix); + master_service_init_log_with_prefix(master_service, global_log_prefix); } static void main_init(void) @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) if (master_service_settings_read_simple(master_service, NULL, &error) < 0) i_fatal("Error reading configuration: %s", error); - master_service_init_log(master_service, global_log_prefix); + master_service_init_log_with_prefix(master_service, global_log_prefix); verbose_proctitle = master_service_settings_get(master_service)->verbose_proctitle; diff --git a/src/util/script-login.c b/src/util/script-login.c index cf72324c7e..485ba0537e 100644 --- a/src/util/script-login.c +++ b/src/util/script-login.c @@ -112,7 +112,7 @@ static void client_connected(struct master_service_connection *conn) } env_put(t_strconcat(ENV_USERDB_KEYS"=", str_c(keys), NULL)); - master_service_init_log(master_service, + master_service_init_log_with_prefix(master_service, t_strdup_printf("script-login(%s): ", input.username)); if (drop_to_userdb_privileges) {