aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/postmaster/postmaster.c20
-rw-r--r--src/backend/tcop/postgres.c8
-rw-r--r--src/backend/utils/error/elog.c51
-rw-r--r--src/backend/utils/misc/guc.c27
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample3
-rw-r--r--src/include/tcop/tcopprot.h3
-rw-r--r--src/include/utils/elog.h4
7 files changed, 15 insertions, 101 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 2a420bfdbf0..d7f26516d4a 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.373 2004/03/10 21:12:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.374 2004/03/15 15:56:21 momjian Exp $
*
* NOTES
*
@@ -212,8 +212,7 @@ int CheckPointTimeout = 300;
int CheckPointWarning = 30;
time_t LastSignalledCheckpoint = 0;
-bool log_hostname; /* for ps display */
-bool LogSourcePort;
+bool log_hostname; /* for ps display and logging */
bool Log_connections = false;
bool Db_user_namespace = false;
@@ -2414,6 +2413,7 @@ BackendInit(Port *port)
struct timezone tz;
char remote_host[NI_MAXHOST];
char remote_port[NI_MAXSERV];
+ char remote_ps_data[NI_MAXHOST];
IsUnderPostmaster = true; /* we are a postmaster subprocess now */
@@ -2474,21 +2474,15 @@ BackendInit(Port *port)
remote_port, sizeof(remote_port),
NI_NUMERICHOST | NI_NUMERICSERV);
}
+ snprintf(remote_ps_data, sizeof(remote_ps_data),
+ remote_port[0] == '\0' ? "%s" : "%s(%s)",
+ remote_host, remote_port);
if (Log_connections)
ereport(LOG,
(errmsg("connection received: host=%s port=%s",
remote_host, remote_port)));
- if (LogSourcePort)
- {
- /* modify remote_host for use in ps status */
- char tmphost[NI_MAXHOST];
-
- snprintf(tmphost, sizeof(tmphost), "%s(%s)", remote_host, remote_port);
- StrNCpy(remote_host, tmphost, sizeof(remote_host));
- }
-
/*
* save remote_host and remote_port in port stucture
*/
@@ -2517,7 +2511,7 @@ BackendInit(Port *port)
* title for ps. It's good to do this as early as possible in
* startup.
*/
- init_ps_display(port->user_name, port->database_name, remote_host);
+ init_ps_display(port->user_name, port->database_name, remote_ps_data);
set_ps_display("authentication");
/*
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index ef59e78fbdd..659eda80c85 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.394 2004/03/09 04:43:07 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.395 2004/03/15 15:56:22 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -3212,11 +3212,7 @@ log_disconnections(int code, Datum arg)
snprintf(dbname, sizeof(dbname)," database=%s",port->database_name);
snprintf(remote_host,sizeof(remote_host)," host=%s",
port->remote_host);
- /* prevent redundant or empty reporting of port */
- if (!LogSourcePort && strlen(port->remote_port))
- snprintf(remote_port,sizeof(remote_port)," port=%s",port->remote_port);
- else
- remote_port[0] = '\0';
+ snprintf(remote_port,sizeof(remote_port)," port=%s",port->remote_port);
gettimeofday(&end,NULL);
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index d516d2d72ec..f62bcd8ff3b 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.127 2004/03/09 04:43:07 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.128 2004/03/15 15:56:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -69,9 +69,6 @@ ErrorContextCallback *error_context_stack = NULL;
/* GUC parameters */
PGErrorVerbosity Log_error_verbosity = PGERROR_VERBOSE;
-bool Log_timestamp = false; /* show timestamps in stderr
- * output */
-bool Log_pid = false; /* show PIDs in stderr output */
char *Log_line_prefix = ""; /* format for extra log line info */
#ifdef HAVE_SYSLOG
@@ -144,8 +141,6 @@ static void send_message_to_frontend(ErrorData *edata);
static char *expand_fmt_string(const char *fmt, ErrorData *edata);
static const char *useful_strerror(int errnum);
static const char *error_severity(int elevel);
-static const char *print_timestamp(void);
-static const char *print_pid(void);
static void append_with_tabs(StringInfo buf, const char *str);
static const char *log_line_prefix(void);
@@ -1134,7 +1129,7 @@ log_line_prefix(void)
case 'r':
j += snprintf(result+j,result_len-j,"%s",
MyProcPort->remote_host);
- if (!LogSourcePort && strlen(MyProcPort->remote_port))
+ if (strlen(MyProcPort->remote_port) > 0)
j += snprintf(result+j,result_len-j,"(%s)",
MyProcPort->remote_port);
break;
@@ -1293,10 +1288,7 @@ send_message_to_server_log(ErrorData *edata)
* Timestamp and PID are only used for stderr output --- we assume
* the syslog daemon will supply them for us in the other case.
*/
- fprintf(stderr, "%s%s%s",
- Log_timestamp ? print_timestamp() : "",
- Log_pid ? print_pid() : "",
- buf.data);
+ fprintf(stderr, "%s",buf.data);
}
pfree(buf.data);
@@ -1569,43 +1561,6 @@ error_severity(int elevel)
/*
- * Return a timestamp string like
- *
- * "2000-06-04 13:12:03 "
- */
-static const char *
-print_timestamp(void)
-{
- time_t curtime;
- static char buf[21]; /* format `YYYY-MM-DD HH:MM:SS ' */
-
- curtime = time(NULL);
-
- strftime(buf, sizeof(buf),
- "%Y-%m-%d %H:%M:%S ",
- localtime(&curtime));
-
- return buf;
-}
-
-
-/*
- * Return a string like
- *
- * "[123456] "
- *
- * with the current pid.
- */
-static const char *
-print_pid(void)
-{
- static char buf[10]; /* allow `[123456] ' */
-
- snprintf(buf, sizeof(buf), "[%d] ", (int) MyProcPid);
- return buf;
-}
-
-/*
* append_with_tabs
*
* Append the string to the StringInfo buffer, inserting a tab after any
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index e8a28aaa448..d83c582b01d 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.189 2004/03/09 04:43:07 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.190 2004/03/15 15:56:24 momjian Exp $
*
*--------------------------------------------------------------------
*/
@@ -508,22 +508,6 @@ static struct config_bool ConfigureNamesBool[] =
&Log_disconnections,
false, NULL, NULL
},
- {
- {"log_timestamp", PGC_SIGHUP, LOGGING_WHAT,
- gettext_noop("Prefixes server log messages with a time stamp."),
- NULL
- },
- &Log_timestamp,
- false, NULL, NULL
- },
- {
- {"log_pid", PGC_SIGHUP, LOGGING_WHAT,
- gettext_noop("Prefixes server log messages with the server PID."),
- NULL
- },
- &Log_pid,
- false, NULL, NULL
- },
#ifdef USE_ASSERT_CHECKING
{
@@ -751,15 +735,6 @@ static struct config_bool ConfigureNamesBool[] =
false, NULL, NULL
},
{
- {"log_source_port", PGC_SIGHUP, LOGGING_WHAT,
- gettext_noop("Logs the outgoing port number of the connecting host."),
- NULL
- },
- &LogSourcePort,
- false, NULL, NULL
- },
-
- {
{"sql_inheritance", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
gettext_noop("Causes subtables to be included by default in various commands."),
NULL
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 8830f822bcd..91b0340963c 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -184,7 +184,6 @@
#log_connections = false
#log_disconnections = false
#log_duration = false
-#log_pid = false
#log_line_prefix = '' # e.g. '<%u%%%d> '
# %u=user name %d=database name
# %r=remote host and port
@@ -194,9 +193,7 @@
# %x=stop here in non-session processes
# %%='%'
#log_statement = false
-#log_timestamp = false
#log_hostname = false
-#log_source_port = false
#---------------------------------------------------------------------------
diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h
index 29a9e953651..20c84dd9252 100644
--- a/src/include/tcop/tcopprot.h
+++ b/src/include/tcop/tcopprot.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/tcop/tcopprot.h,v 1.61 2003/11/29 22:41:14 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/tcop/tcopprot.h,v 1.62 2004/03/15 15:56:27 momjian Exp $
*
* OLD COMMENTS
* This file was created so that other c files could get the two
@@ -30,7 +30,6 @@ extern bool Warn_restart_ready;
extern bool InError;
extern CommandDest whereToSendOutput;
extern bool log_hostname;
-extern bool LogSourcePort;
extern DLLIMPORT const char *debug_query_string;
extern char *rendezvous_name;
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h
index 4a7629e90d7..f71881547eb 100644
--- a/src/include/utils/elog.h
+++ b/src/include/utils/elog.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.65 2004/03/09 04:43:07 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.66 2004/03/15 15:56:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -169,8 +169,6 @@ typedef enum
} PGErrorVerbosity;
extern PGErrorVerbosity Log_error_verbosity;
-extern bool Log_timestamp;
-extern bool Log_pid;
extern char *Log_line_prefix;
#ifdef HAVE_SYSLOG