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

Commit 7380b63

Browse files
committed
Don't append epoch to log_filename if no format specifier is given.
Robert Haas
1 parent 7babccb commit 7380b63

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

doc/src/sgml/config.sgml

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.209 2009/02/22 23:50:30 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.210 2009/02/24 12:09:08 petere Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -2398,16 +2398,20 @@ local0.* /var/log/postgresql
23982398
so <literal>%</literal>-escapes can be used to specify time-varying
23992399
file names. (Note that if there are
24002400
any time-zone-dependent <literal>%</literal>-escapes, the computation
2401-
is done in the zone specified by <xref linkend="guc-log-timezone">.)
2402-
If no <literal>%</literal>-escapes are present,
2403-
<productname>PostgreSQL</productname> will append the epoch of the new
2404-
log file's creation time. For example, if
2405-
<varname>log_filename</varname> were <literal>server_log</literal>,
2406-
then the chosen file name would be <literal>server_log.1093827753</>
2407-
for a log starting at Sun Aug 29 19:02:33 2004 MST.
2401+
is done in the zone specified
2402+
by <xref linkend="guc-log-timezone">.)
24082403
Note that the system's <systemitem>strftime</systemitem> is not used
24092404
directly, so platform-specific (nonstandard) extensions do not work.
24102405
</para>
2406+
<para>
2407+
If you specify a file name without escapes, you should plan to
2408+
use a log rotation utility to avoid eventually filling the
2409+
entire disk. In releases prior to 8.4, if
2410+
no <literal>%</literal> escapes were
2411+
present, <productname>PostgreSQL</productname> would append
2412+
the epoch of the new log file's creation time, but this is no
2413+
longer the case.
2414+
</para>
24112415
<para>
24122416
If CSV-format output is enabled in <varname>log_destination</>,
24132417
<literal>.csv</> will be appended to the timestamped

src/backend/postmaster/syslogger.c

+4-13
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
*
2020
* IDENTIFICATION
21-
* $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.48 2009/02/03 00:59:26 tgl Exp $
21+
* $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.49 2009/02/24 12:09:09 petere Exp $
2222
*
2323
*-------------------------------------------------------------------------
2424
*/
@@ -1191,18 +1191,9 @@ logfile_getname(pg_time_t timestamp, char *suffix)
11911191

11921192
len = strlen(filename);
11931193

1194-
if (strchr(Log_filename, '%'))
1195-
{
1196-
/* treat it as a strftime pattern */
1197-
pg_strftime(filename + len, MAXPGPATH - len, Log_filename,
1198-
pg_localtime(&timestamp, log_timezone));
1199-
}
1200-
else
1201-
{
1202-
/* no strftime escapes, so append timestamp to new filename */
1203-
snprintf(filename + len, MAXPGPATH - len, "%s.%lu",
1204-
Log_filename, (unsigned long) timestamp);
1205-
}
1194+
/* treat it as a strftime pattern */
1195+
pg_strftime(filename + len, MAXPGPATH - len, Log_filename,
1196+
pg_localtime(&timestamp, log_timezone));
12061197

12071198
if (suffix != NULL)
12081199
{

0 commit comments

Comments
 (0)