@@ -48,7 +48,7 @@ static char *get_log_message(const char *fmt, va_list args) pg_attribute_printf(
48
48
49
49
/* Functions to work with log files */
50
50
static void open_logfile (FILE * * file , const char * filename_format );
51
- static void release_logfile (void );
51
+ static void release_logfile (bool fatal , void * userdata );
52
52
static char * logfile_getname (const char * format , time_t timestamp );
53
53
static FILE * logfile_open (const char * filename , const char * mode );
54
54
@@ -224,12 +224,7 @@ elog_internal(int elevel, bool file_only, const char *message)
224
224
if (write_to_file )
225
225
{
226
226
if (log_file == NULL )
227
- {
228
- if (logger_config .log_filename == NULL )
229
- open_logfile (& log_file , LOG_FILENAME_DEFAULT );
230
- else
231
- open_logfile (& log_file , logger_config .log_filename );
232
- }
227
+ open_logfile (& log_file , logger_config .log_filename ? logger_config .log_filename : LOG_FILENAME_DEFAULT );
233
228
234
229
fprintf (log_file , "%s " , strfbuf );
235
230
fprintf (log_file , "%s " , str_pid );
@@ -699,7 +694,7 @@ open_logfile(FILE **file, const char *filename_format)
699
694
*/
700
695
if (!exit_hook_registered )
701
696
{
702
- atexit (release_logfile );
697
+ pgut_atexit_push (release_logfile , NULL );
703
698
exit_hook_registered = true;
704
699
}
705
700
}
@@ -708,7 +703,7 @@ open_logfile(FILE **file, const char *filename_format)
708
703
* Closes opened file.
709
704
*/
710
705
static void
711
- release_logfile (void )
706
+ release_logfile (bool fatal , void * userdata )
712
707
{
713
708
if (log_file )
714
709
{
0 commit comments