diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2013-06-13 23:15:15 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2013-06-13 23:15:15 -0400 |
commit | c62866eeafd52822ec61a0d2db9428c05e97d3cc (patch) | |
tree | de37c26c1363bdb8451972ea1f92f364e1a9906e /src | |
parent | f04216341dd1cc235e975f93ac806d9d3729a344 (diff) | |
download | postgresql-c62866eeafd52822ec61a0d2db9428c05e97d3cc.tar.gz postgresql-c62866eeafd52822ec61a0d2db9428c05e97d3cc.zip |
Remove special-case treatment of LOG severity level in standalone mode.
elog.c has historically treated LOG messages as low-priority during
bootstrap and standalone operation. This has led to confusion and even
masked a bug, because the normal expectation of code authors is that
elog(LOG) will put something into the postmaster log, and that wasn't
happening during initdb. So get rid of the special-case rule and make
the priority order the same as it is in normal operation. To keep from
cluttering initdb's output and the behavior of a standalone backend,
tweak the severity level of three messages routinely issued by xlog.c
during startup and shutdown so that they won't appear in these cases.
Per my proposal back in December.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/access/transam/xlog.c | 11 | ||||
-rw-r--r-- | src/backend/utils/error/elog.c | 6 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 7210ca5fddb..654c9c18d8b 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -4883,9 +4883,12 @@ StartupXLOG(void) (errmsg("control file contains invalid data"))); if (ControlFile->state == DB_SHUTDOWNED) - ereport(LOG, + { + /* This is the expected case, so don't be chatty in standalone mode */ + ereport(IsPostmasterEnvironment ? LOG : NOTICE, (errmsg("database system was shut down at %s", str_time(ControlFile->time)))); + } else if (ControlFile->state == DB_SHUTDOWNED_IN_RECOVERY) ereport(LOG, (errmsg("database system was shut down in recovery at %s", @@ -6590,7 +6593,8 @@ GetNextXidAndEpoch(TransactionId *xid, uint32 *epoch) void ShutdownXLOG(int code, Datum arg) { - ereport(LOG, + /* Don't be chatty in standalone mode */ + ereport(IsPostmasterEnvironment ? LOG : NOTICE, (errmsg("shutting down"))); if (RecoveryInProgress()) @@ -6612,7 +6616,8 @@ ShutdownXLOG(int code, Datum arg) ShutdownSUBTRANS(); ShutdownMultiXact(); - ereport(LOG, + /* Don't be chatty in standalone mode */ + ereport(IsPostmasterEnvironment ? LOG : NOTICE, (errmsg("database system is shut down"))); } diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index e9eb3d5be8c..7f03f419dea 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -285,11 +285,7 @@ errstart(int elevel, const char *filename, int lineno, */ /* Determine whether message is enabled for server log output */ - if (IsPostmasterEnvironment) - output_to_server = is_log_level_output(elevel, log_min_messages); - else - /* In bootstrap/standalone case, do not sort LOG out-of-order */ - output_to_server = (elevel >= log_min_messages); + output_to_server = is_log_level_output(elevel, log_min_messages); /* Determine whether message is enabled for client output */ if (whereToSendOutput == DestRemote && elevel != COMMERROR) |