Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d6b5792

Browse files
committed
Remove GUC log_statement, log_pid, log_timestamp, log_source_port.
Functionality superceeded by log_line_prefix. Andrew Dunstan
1 parent 6812e95 commit d6b5792

File tree

8 files changed

+22
-140
lines changed

8 files changed

+22
-140
lines changed

doc/src/sgml/runtime.sgml

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.249 2004/03/12 00:56:00 neilc Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.250 2004/03/15 15:56:21 momjian Exp $
33
-->
44

55
<Chapter Id="runtime">
@@ -1994,7 +1994,8 @@ SET ENABLE_SEQSCAN TO OFF;
19941994
<para>
19951995
Causes the duration of every completed statement to be logged.
19961996
To use this option, it is recommended that you also enable
1997-
<varname>log_statement</> and <varname>log_pid</> so that you
1997+
<varname>log_statement</> and if not using <application>syslog</>
1998+
log the PID using <varname>log_line_prefix</> so that you
19981999
can link the statement to the duration using the process
19992000
ID. The default is off. Only superusers can turn off this
20002001
option if it is enabled by the administrator.
@@ -2015,6 +2016,8 @@ SET ENABLE_SEQSCAN TO OFF;
20152016
processes without controlling sessions. <application>Syslog</> produces its own
20162017
timestamp and process ID information, so you probably do not want to
20172018
use those escapes if you are using <application>syslog</>.
2019+
This option can only be set at server start or in the
2020+
<filename>postgresql.conf</filename> configuration file.
20182021
<informaltable>
20192022
<tgroup cols="3">
20202023
<thead>
@@ -2059,7 +2062,8 @@ SET ENABLE_SEQSCAN TO OFF;
20592062
<row>
20602063
<entry><literal>%c</literal></entry>
20612064
<entry>Session ID. A unique identifier for each session.
2062-
It is 2 4-byte hexadecimal numbers separated by a dot. The numbers
2065+
It is 2 4-byte hexadecimal numbers (without leading zeros)
2066+
separated by a dot. The numbers
20632067
are the Session Start Time and the Process ID, so this can also
20642068
be used as a space saving way of printing these items.</entry>
20652069
<entry>Yes</entry>
@@ -2094,19 +2098,6 @@ SET ENABLE_SEQSCAN TO OFF;
20942098
</listitem>
20952099
</varlistentry>
20962100

2097-
<varlistentry>
2098-
<term><varname>log_pid</varname> (<type>boolean</type>)</term>
2099-
<listitem>
2100-
<para>
2101-
Prefixes each message in the server log file with the process ID of
2102-
the server process. This is useful to sort out which messages
2103-
pertain to which connection. The default is off. This parameter
2104-
does not affect messages logged via <application>syslog</>, which
2105-
always contain the process ID.
2106-
</para>
2107-
</listitem>
2108-
</varlistentry>
2109-
21102101
<varlistentry id="guc-log-statement" xreflabel="log_statement">
21112102
<term><varname>log_statement</varname> (<type>boolean</type>)</term>
21122103
<listitem>
@@ -2121,16 +2112,6 @@ SET ENABLE_SEQSCAN TO OFF;
21212112
</listitem>
21222113
</varlistentry>
21232114

2124-
<varlistentry id="guc-log-timestamp" xreflabel="log_timestamp">
2125-
<term><varname>log_timestamp</varname> (<type>boolean</type>)</term>
2126-
<listitem>
2127-
<para>
2128-
Prefixes each server log message with a time stamp. The default
2129-
is off.
2130-
</para>
2131-
</listitem>
2132-
</varlistentry>
2133-
21342115
<varlistentry id="guc-log-hostname" xreflabel="log_hostname">
21352116
<term><varname>log_hostname</varname> (<type>boolean</type>)</term>
21362117
<listitem>
@@ -2144,19 +2125,6 @@ SET ENABLE_SEQSCAN TO OFF;
21442125
</listitem>
21452126
</varlistentry>
21462127

2147-
<varlistentry id="guc-log-source-port" xreflabel="log_source_port">
2148-
<term><varname>log_source_port</varname> (<type>boolean</type>)</term>
2149-
<listitem>
2150-
<para>
2151-
Shows the outgoing port number of the connecting host in the
2152-
connection log messages. You could trace back the port number
2153-
to find out what user initiated the connection. Other than
2154-
that, it's pretty useless and therefore off by default. This
2155-
option can only be set at server start.
2156-
</para>
2157-
</listitem>
2158-
</varlistentry>
2159-
21602128
</variablelist>
21612129
</sect3>
21622130
</sect2>

src/backend/postmaster/postmaster.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.373 2004/03/10 21:12:46 momjian Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.374 2004/03/15 15:56:21 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -212,8 +212,7 @@ int CheckPointTimeout = 300;
212212
int CheckPointWarning = 30;
213213
time_t LastSignalledCheckpoint = 0;
214214

215-
bool log_hostname; /* for ps display */
216-
bool LogSourcePort;
215+
bool log_hostname; /* for ps display and logging */
217216
bool Log_connections = false;
218217
bool Db_user_namespace = false;
219218

@@ -2414,6 +2413,7 @@ BackendInit(Port *port)
24142413
struct timezone tz;
24152414
char remote_host[NI_MAXHOST];
24162415
char remote_port[NI_MAXSERV];
2416+
char remote_ps_data[NI_MAXHOST];
24172417

24182418
IsUnderPostmaster = true; /* we are a postmaster subprocess now */
24192419

@@ -2474,21 +2474,15 @@ BackendInit(Port *port)
24742474
remote_port, sizeof(remote_port),
24752475
NI_NUMERICHOST | NI_NUMERICSERV);
24762476
}
2477+
snprintf(remote_ps_data, sizeof(remote_ps_data),
2478+
remote_port[0] == '\0' ? "%s" : "%s(%s)",
2479+
remote_host, remote_port);
24772480

24782481
if (Log_connections)
24792482
ereport(LOG,
24802483
(errmsg("connection received: host=%s port=%s",
24812484
remote_host, remote_port)));
24822485

2483-
if (LogSourcePort)
2484-
{
2485-
/* modify remote_host for use in ps status */
2486-
char tmphost[NI_MAXHOST];
2487-
2488-
snprintf(tmphost, sizeof(tmphost), "%s(%s)", remote_host, remote_port);
2489-
StrNCpy(remote_host, tmphost, sizeof(remote_host));
2490-
}
2491-
24922486
/*
24932487
* save remote_host and remote_port in port stucture
24942488
*/
@@ -2517,7 +2511,7 @@ BackendInit(Port *port)
25172511
* title for ps. It's good to do this as early as possible in
25182512
* startup.
25192513
*/
2520-
init_ps_display(port->user_name, port->database_name, remote_host);
2514+
init_ps_display(port->user_name, port->database_name, remote_ps_data);
25212515
set_ps_display("authentication");
25222516

25232517
/*

src/backend/tcop/postgres.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.394 2004/03/09 04:43:07 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.395 2004/03/15 15:56:22 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -3212,11 +3212,7 @@ log_disconnections(int code, Datum arg)
32123212
snprintf(dbname, sizeof(dbname)," database=%s",port->database_name);
32133213
snprintf(remote_host,sizeof(remote_host)," host=%s",
32143214
port->remote_host);
3215-
/* prevent redundant or empty reporting of port */
3216-
if (!LogSourcePort && strlen(port->remote_port))
3217-
snprintf(remote_port,sizeof(remote_port)," port=%s",port->remote_port);
3218-
else
3219-
remote_port[0] = '\0';
3215+
snprintf(remote_port,sizeof(remote_port)," port=%s",port->remote_port);
32203216

32213217

32223218
gettimeofday(&end,NULL);

src/backend/utils/error/elog.c

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.127 2004/03/09 04:43:07 momjian Exp $
40+
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.128 2004/03/15 15:56:23 momjian Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -69,9 +69,6 @@ ErrorContextCallback *error_context_stack = NULL;
6969

7070
/* GUC parameters */
7171
PGErrorVerbosity Log_error_verbosity = PGERROR_VERBOSE;
72-
bool Log_timestamp = false; /* show timestamps in stderr
73-
* output */
74-
bool Log_pid = false; /* show PIDs in stderr output */
7572
char *Log_line_prefix = ""; /* format for extra log line info */
7673

7774
#ifdef HAVE_SYSLOG
@@ -144,8 +141,6 @@ static void send_message_to_frontend(ErrorData *edata);
144141
static char *expand_fmt_string(const char *fmt, ErrorData *edata);
145142
static const char *useful_strerror(int errnum);
146143
static const char *error_severity(int elevel);
147-
static const char *print_timestamp(void);
148-
static const char *print_pid(void);
149144
static void append_with_tabs(StringInfo buf, const char *str);
150145
static const char *log_line_prefix(void);
151146

@@ -1134,7 +1129,7 @@ log_line_prefix(void)
11341129
case 'r':
11351130
j += snprintf(result+j,result_len-j,"%s",
11361131
MyProcPort->remote_host);
1137-
if (!LogSourcePort && strlen(MyProcPort->remote_port))
1132+
if (strlen(MyProcPort->remote_port) > 0)
11381133
j += snprintf(result+j,result_len-j,"(%s)",
11391134
MyProcPort->remote_port);
11401135
break;
@@ -1293,10 +1288,7 @@ send_message_to_server_log(ErrorData *edata)
12931288
* Timestamp and PID are only used for stderr output --- we assume
12941289
* the syslog daemon will supply them for us in the other case.
12951290
*/
1296-
fprintf(stderr, "%s%s%s",
1297-
Log_timestamp ? print_timestamp() : "",
1298-
Log_pid ? print_pid() : "",
1299-
buf.data);
1291+
fprintf(stderr, "%s",buf.data);
13001292
}
13011293

13021294
pfree(buf.data);
@@ -1568,43 +1560,6 @@ error_severity(int elevel)
15681560
}
15691561

15701562

1571-
/*
1572-
* Return a timestamp string like
1573-
*
1574-
* "2000-06-04 13:12:03 "
1575-
*/
1576-
static const char *
1577-
print_timestamp(void)
1578-
{
1579-
time_t curtime;
1580-
static char buf[21]; /* format `YYYY-MM-DD HH:MM:SS ' */
1581-
1582-
curtime = time(NULL);
1583-
1584-
strftime(buf, sizeof(buf),
1585-
"%Y-%m-%d %H:%M:%S ",
1586-
localtime(&curtime));
1587-
1588-
return buf;
1589-
}
1590-
1591-
1592-
/*
1593-
* Return a string like
1594-
*
1595-
* "[123456] "
1596-
*
1597-
* with the current pid.
1598-
*/
1599-
static const char *
1600-
print_pid(void)
1601-
{
1602-
static char buf[10]; /* allow `[123456] ' */
1603-
1604-
snprintf(buf, sizeof(buf), "[%d] ", (int) MyProcPid);
1605-
return buf;
1606-
}
1607-
16081563
/*
16091564
* append_with_tabs
16101565
*

src/backend/utils/misc/guc.c

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.189 2004/03/09 04:43:07 momjian Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.190 2004/03/15 15:56:24 momjian Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -508,22 +508,6 @@ static struct config_bool ConfigureNamesBool[] =
508508
&Log_disconnections,
509509
false, NULL, NULL
510510
},
511-
{
512-
{"log_timestamp", PGC_SIGHUP, LOGGING_WHAT,
513-
gettext_noop("Prefixes server log messages with a time stamp."),
514-
NULL
515-
},
516-
&Log_timestamp,
517-
false, NULL, NULL
518-
},
519-
{
520-
{"log_pid", PGC_SIGHUP, LOGGING_WHAT,
521-
gettext_noop("Prefixes server log messages with the server PID."),
522-
NULL
523-
},
524-
&Log_pid,
525-
false, NULL, NULL
526-
},
527511

528512
#ifdef USE_ASSERT_CHECKING
529513
{
@@ -750,15 +734,6 @@ static struct config_bool ConfigureNamesBool[] =
750734
&log_hostname,
751735
false, NULL, NULL
752736
},
753-
{
754-
{"log_source_port", PGC_SIGHUP, LOGGING_WHAT,
755-
gettext_noop("Logs the outgoing port number of the connecting host."),
756-
NULL
757-
},
758-
&LogSourcePort,
759-
false, NULL, NULL
760-
},
761-
762737
{
763738
{"sql_inheritance", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
764739
gettext_noop("Causes subtables to be included by default in various commands."),

src/backend/utils/misc/postgresql.conf.sample

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@
184184
#log_connections = false
185185
#log_disconnections = false
186186
#log_duration = false
187-
#log_pid = false
188187
#log_line_prefix = '' # e.g. '<%u%%%d> '
189188
# %u=user name %d=database name
190189
# %r=remote host and port
@@ -194,9 +193,7 @@
194193
# %x=stop here in non-session processes
195194
# %%='%'
196195
#log_statement = false
197-
#log_timestamp = false
198196
#log_hostname = false
199-
#log_source_port = false
200197

201198

202199
#---------------------------------------------------------------------------

src/include/tcop/tcopprot.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/tcop/tcopprot.h,v 1.61 2003/11/29 22:41:14 pgsql Exp $
10+
* $PostgreSQL: pgsql/src/include/tcop/tcopprot.h,v 1.62 2004/03/15 15:56:27 momjian Exp $
1111
*
1212
* OLD COMMENTS
1313
* This file was created so that other c files could get the two
@@ -30,7 +30,6 @@ extern bool Warn_restart_ready;
3030
extern bool InError;
3131
extern CommandDest whereToSendOutput;
3232
extern bool log_hostname;
33-
extern bool LogSourcePort;
3433
extern DLLIMPORT const char *debug_query_string;
3534
extern char *rendezvous_name;
3635

src/include/utils/elog.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.65 2004/03/09 04:43:07 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.66 2004/03/15 15:56:28 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -169,8 +169,6 @@ typedef enum
169169
} PGErrorVerbosity;
170170

171171
extern PGErrorVerbosity Log_error_verbosity;
172-
extern bool Log_timestamp;
173-
extern bool Log_pid;
174172
extern char *Log_line_prefix;
175173

176174
#ifdef HAVE_SYSLOG

0 commit comments

Comments
 (0)