@@ -190,14 +190,14 @@ elog_internal(int elevel, bool file_only, const char *fmt, va_list args)
190190 loggin_in_progress = true;
191191
192192 /* We need copy args only if we need write to error log file */
193- if (write_to_error_log )
194- va_copy (error_args , args );
193+ // if (write_to_error_log)
194+ // va_copy(error_args, args);
195195 /*
196196 * We need copy args only if we need write to stderr. But do not copy args
197197 * if we need to log only to stderr.
198198 */
199- if (write_to_stderr && write_to_file )
200- va_copy (std_args , args );
199+ // if (write_to_stderr && write_to_file)
200+ // va_copy(std_args, args);
201201
202202 if (write_to_file || write_to_error_log )
203203 strftime (strfbuf , sizeof (strfbuf ), "%Y-%m-%d %H:%M:%S %Z" ,
@@ -238,7 +238,8 @@ elog_internal(int elevel, bool file_only, const char *fmt, va_list args)
238238
239239 fprintf (error_log_file , "%s: " , strfbuf );
240240 write_elevel (error_log_file , elevel );
241-
241+
242+ va_copy (error_args , args );
242243 vfprintf (error_log_file , fmt , error_args );
243244 fputc ('\n' , error_log_file );
244245 fflush (error_log_file );
@@ -253,7 +254,7 @@ elog_internal(int elevel, bool file_only, const char *fmt, va_list args)
253254 if (write_to_stderr )
254255 {
255256 write_elevel (stderr , elevel );
256-
257+ va_copy ( std_args , args );
257258 if (write_to_file )
258259 vfprintf (stderr , fmt , std_args );
259260 else
0 commit comments