@@ -48,7 +48,7 @@ static char *get_log_message(const char *fmt, va_list args) pg_attribute_printf(
4848
4949/* Functions to work with log files */
5050static void open_logfile (FILE * * file , const char * filename_format );
51- static void release_logfile (void );
51+ static void release_logfile (bool fatal , void * userdata );
5252static char * logfile_getname (const char * format , time_t timestamp );
5353static FILE * logfile_open (const char * filename , const char * mode );
5454
@@ -224,12 +224,7 @@ elog_internal(int elevel, bool file_only, const char *message)
224224 if (write_to_file )
225225 {
226226 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 );
233228
234229 fprintf (log_file , "%s " , strfbuf );
235230 fprintf (log_file , "%s " , str_pid );
@@ -699,7 +694,7 @@ open_logfile(FILE **file, const char *filename_format)
699694 */
700695 if (!exit_hook_registered )
701696 {
702- atexit (release_logfile );
697+ pgut_atexit_push (release_logfile , NULL );
703698 exit_hook_registered = true;
704699 }
705700}
@@ -708,7 +703,7 @@ open_logfile(FILE **file, const char *filename_format)
708703 * Closes opened file.
709704 */
710705static void
711- release_logfile (void )
706+ release_logfile (bool fatal , void * userdata )
712707{
713708 if (log_file )
714709 {
0 commit comments