diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c
index 5434826..6c3b632 100644
--- a/src/backend/postmaster/syslogger.c
+++ b/src/backend/postmaster/syslogger.c
@@ -147,6 +147,7 @@ static char *logfile_getname(pg_time_t timestamp, const char *suffix);
 static void set_next_rotation_time(void);
 static void sigHupHandler(SIGNAL_ARGS);
 static void sigUsr1Handler(SIGNAL_ARGS);
+static bool rm_log_metainfo(void);
 static void logfile_writename(void);
 
 
@@ -343,7 +344,8 @@ SysLoggerMain(int argc, char *argv[])
 			 * wait until the next logfile rotation, which could be some while
 			 * in the future.
 			 */
-			logfile_writename();
+			if (!rm_log_metainfo())
+				logfile_writename();
 
 			/*
 			 * Check if the log directory or filename pattern changed in
@@ -617,7 +619,8 @@ SysLogger_Start(void)
 
 	syslogFile = logfile_open(last_file_name, "a", false);
 
-	logfile_writename();
+	if (!rm_log_metainfo())
+		logfile_writename();
 	pfree(last_file_name);
 
 #ifdef EXEC_BACKEND
@@ -1417,6 +1420,22 @@ sigUsr1Handler(SIGNAL_ARGS)
 
 	errno = save_errno;
 }
+ 
+ /*
+ * Delete the LOG_METAINFO_DATAFILE if it's not going to be used.
+ */
+static bool
+rm_log_metainfo(void)
+{
+	if (!(Log_destination & LOG_DESTINATION_STDERR)
+		&& !(Log_destination & LOG_DESTINATION_CSVLOG))
+	{
+		unlink(LOG_METAINFO_DATAFILE);
+		return true;
+	}
+	return false;
+}
+
 
 /*
  * Store the name of the file(s) where the log collector, when enabled, writes
@@ -1430,13 +1449,6 @@ logfile_writename(void)
 	FILE	*fh;
 	char	tempfn[MAXPGPATH];
 
-	if (!(Log_destination & LOG_DESTINATION_STDERR)
-		&& !(Log_destination & LOG_DESTINATION_CSVLOG))
-	{
-		unlink(LOG_METAINFO_DATAFILE);
-		return;
-	}
-
 	snprintf(tempfn, sizeof(tempfn), "%s.tmp", LOG_METAINFO_DATAFILE);
 
 	if ((fh = logfile_open(tempfn, "w", true) ) == NULL)
