]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Use master_service_init_log_with_prefix() where explicit prefix is wanted
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 20 Apr 2020 18:41:39 +0000 (21:41 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Fri, 24 Apr 2020 10:42:00 +0000 (10:42 +0000)
src/director/main.c
src/lib-master/master-service.c
src/lib-storage/mail-storage-service.c
src/log/main.c
src/util/script-login.c

index b77329b091137dc214d9fe04e32aa52f494166bf..0dc8db98e3091d98f1699c41cec969ee3bafc483 100644 (file)
@@ -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)));
        }
index 07c4a9c4b54732b7981379318d3f9b34255ca9c3..ee00d895ef36e398e9328a9bb9c3b2b4f4908bbd 100644 (file)
@@ -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));
 }
 
index 7ffa21145a95b84b860611c932a5ba19aeeb97c6..e3d581ba7c4fadc2e3a0537f55099b5e132d1c4e 100644 (file)
@@ -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,
index 98c698debaa622458f78df6f5096e33b6ed01031..a6ac950a67940d2be3afe2d2f7249216b875c308 100644 (file)
@@ -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;
 
index cf72324c7ee6aa568633d964110aca5200e90719..485ba0537eb11f185e4a48159e887d0651254ab6 100644 (file)
@@ -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) {