@@ -177,6 +177,9 @@ elog_internal(int elevel, bool file_only, const char *fmt, va_list args)
177
177
* There is no need to lock if this is elog() from upper elog().
178
178
*/
179
179
#ifdef WIN32
180
+ std_args = NULL ;
181
+ error_args = NULL ;
182
+
180
183
if (log_file_mutex == NULL )
181
184
{
182
185
while (InterlockedExchange (& mutex_initlock , 1 ) == 1 )
@@ -190,14 +193,14 @@ elog_internal(int elevel, bool file_only, const char *fmt, va_list args)
190
193
loggin_in_progress = true;
191
194
192
195
/* 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);
196
+ if (write_to_error_log )
197
+ va_copy (error_args , args );
195
198
/*
196
199
* We need copy args only if we need write to stderr. But do not copy args
197
200
* if we need to log only to stderr.
198
201
*/
199
- // if (write_to_stderr && write_to_file)
200
- // va_copy(std_args, args);
202
+ if (write_to_stderr && write_to_file )
203
+ va_copy (std_args , args );
201
204
202
205
if (write_to_file || write_to_error_log )
203
206
strftime (strfbuf , sizeof (strfbuf ), "%Y-%m-%d %H:%M:%S %Z" ,
@@ -239,7 +242,6 @@ elog_internal(int elevel, bool file_only, const char *fmt, va_list args)
239
242
fprintf (error_log_file , "%s: " , strfbuf );
240
243
write_elevel (error_log_file , elevel );
241
244
242
- va_copy (error_args , args );
243
245
vfprintf (error_log_file , fmt , error_args );
244
246
fputc ('\n' , error_log_file );
245
247
fflush (error_log_file );
@@ -254,7 +256,6 @@ elog_internal(int elevel, bool file_only, const char *fmt, va_list args)
254
256
if (write_to_stderr )
255
257
{
256
258
write_elevel (stderr , elevel );
257
- va_copy (std_args , args );
258
259
if (write_to_file )
259
260
vfprintf (stderr , fmt , std_args );
260
261
else
0 commit comments