* Log_destination permits. We don't do this until the postmaster is
* fully launched, since startup failures may as well be reported to
* stderr.
+ *
+ * If we are in fact disabling logging to stderr, first emit a log message
+ * saying so, to provide a breadcrumb trail for users who may not remember
+ * that their logging is configured to go somewhere else.
*/
+ if (!(Log_destination & LOG_DESTINATION_STDERR))
+ ereport(LOG,
+ (errmsg("ending log output to stderr"),
+ errhint("Future log output will go to log destination \"%s\".",
+ Log_destination_string)));
+
whereToSendOutput = DestNone;
/*
/* now we redirect stderr, if not done already */
if (!redirection_done)
{
+#ifdef WIN32
+ int fd;
+#endif
+
+ /*
+ * Leave a breadcrumb trail when redirecting, in case the user
+ * forgets that redirection is active and looks only at the
+ * original stderr target file.
+ */
+ ereport(LOG,
+ (errmsg("redirecting log output to logging collector process"),
+ errhint("Future log output will appear in directory \"%s\".",
+ Log_directory)));
+
#ifndef WIN32
fflush(stdout);
if (dup2(syslogPipe[1], fileno(stdout)) < 0)
close(syslogPipe[1]);
syslogPipe[1] = -1;
#else
- int fd;
-
/*
* open the pipe in binary mode and make sure stderr is binary
* after it's been dup'ed into, to avoid disturbing the pipe
int Log_error_verbosity = PGERROR_VERBOSE;
char *Log_line_prefix = NULL; /* format for extra log line info */
int Log_destination = LOG_DESTINATION_STDERR;
+char *Log_destination_string = NULL;
#ifdef HAVE_SYSLOG
* cases provide the value for SHOW to display. The real state is elsewhere
* and is kept in sync by assign_hooks.
*/
-static char *log_destination_string;
-
static char *syslog_ident_str;
static bool phony_autocommit;
static bool session_auth_is_superuser;
"depending on the platform."),
GUC_LIST_INPUT
},
- &log_destination_string,
+ &Log_destination_string,
"stderr",
check_log_destination, assign_log_destination, NULL
},
extern int Log_error_verbosity;
extern char *Log_line_prefix;
extern int Log_destination;
+extern char *Log_destination_string;
/* Log destination bitmap */
#define LOG_DESTINATION_STDERR 1