diff options
author | Peter Eisentraut | 2009-02-24 12:09:09 +0000 |
---|---|---|
committer | Peter Eisentraut | 2009-02-24 12:09:09 +0000 |
commit | 198053cc73d734716b4e008c14dd3cb6dce58891 (patch) | |
tree | 84cbac128118dd8a9234eb0f7f66ed2419db01c7 | |
parent | a3c594d20e6e713c2bed8e0ba416ab34cdec8ecf (diff) |
Don't append epoch to log_filename if no format specifier is given.
Robert Haas
-rw-r--r-- | doc/src/sgml/config.sgml | 18 | ||||
-rw-r--r-- | src/backend/postmaster/syslogger.c | 15 |
2 files changed, 14 insertions, 19 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 223911c7c6..2ceeaf7a19 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -2398,17 +2398,21 @@ local0.* /var/log/postgresql so <literal>%</literal>-escapes can be used to specify time-varying file names. (Note that if there are any time-zone-dependent <literal>%</literal>-escapes, the computation - is done in the zone specified by <xref linkend="guc-log-timezone">.) - If no <literal>%</literal>-escapes are present, - <productname>PostgreSQL</productname> will append the epoch of the new - log file's creation time. For example, if - <varname>log_filename</varname> were <literal>server_log</literal>, - then the chosen file name would be <literal>server_log.1093827753</> - for a log starting at Sun Aug 29 19:02:33 2004 MST. + is done in the zone specified + by <xref linkend="guc-log-timezone">.) Note that the system's <systemitem>strftime</systemitem> is not used directly, so platform-specific (nonstandard) extensions do not work. </para> <para> + If you specify a file name without escapes, you should plan to + use a log rotation utility to avoid eventually filling the + entire disk. In releases prior to 8.4, if + no <literal>%</literal> escapes were + present, <productname>PostgreSQL</productname> would append + the epoch of the new log file's creation time, but this is no + longer the case. + </para> + <para> If CSV-format output is enabled in <varname>log_destination</>, <literal>.csv</> will be appended to the timestamped log file name to create the file name for CSV-format output. diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c index 988b0e04ff..0f8d93a968 100644 --- a/src/backend/postmaster/syslogger.c +++ b/src/backend/postmaster/syslogger.c @@ -1191,18 +1191,9 @@ logfile_getname(pg_time_t timestamp, char *suffix) len = strlen(filename); - if (strchr(Log_filename, '%')) - { - /* treat it as a strftime pattern */ - pg_strftime(filename + len, MAXPGPATH - len, Log_filename, - pg_localtime(×tamp, log_timezone)); - } - else - { - /* no strftime escapes, so append timestamp to new filename */ - snprintf(filename + len, MAXPGPATH - len, "%s.%lu", - Log_filename, (unsigned long) timestamp); - } + /* treat it as a strftime pattern */ + pg_strftime(filename + len, MAXPGPATH - len, Log_filename, + pg_localtime(×tamp, log_timezone)); if (suffix != NULL) { |