1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Replace log_filename_prefix with more general log_filename parameter,

to allow DBA to choose the form in which log filenames reflect the
current time.  Also allow for truncating instead of appending to
pre-existing files --- this is convenient when the log filename pattern
rewrites the same names cyclically.  Per Ed L.
This commit is contained in:
Tom Lane
2004-08-31 04:53:44 +00:00
parent 25aba1cafd
commit 8c603f2c95
5 changed files with 166 additions and 67 deletions

View File

@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.235 2004/08/30 02:54:40 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.236 2004/08/31 04:53:44 tgl Exp $
*
*--------------------------------------------------------------------
*/
@@ -812,6 +812,14 @@ static struct config_bool ConfigureNamesBool[] =
&Redirect_stderr,
false, NULL, NULL
},
{
{"log_truncate_on_rotation", PGC_SIGHUP, LOGGING_WHERE,
gettext_noop("Truncate existing log files of same name during log rotation"),
NULL
},
&Log_truncate_on_rotation,
false, NULL, NULL
},
#ifdef WAL_DEBUG
{
@@ -1665,7 +1673,7 @@ static struct config_string ConfigureNamesString[] =
},
{
{"log_directory", PGC_SIGHUP, LOGGING_WHERE,
gettext_noop("Sets the destination directory for logfiles."),
gettext_noop("Sets the destination directory for log files."),
gettext_noop("May be specified as relative to the cluster directory "
"or as absolute path.")
},
@@ -1673,12 +1681,12 @@ static struct config_string ConfigureNamesString[] =
"pg_log", NULL, NULL
},
{
{"log_filename_prefix", PGC_SIGHUP, LOGGING_WHERE,
gettext_noop("Prefix for file names created in the log_directory."),
{"log_filename", PGC_SIGHUP, LOGGING_WHERE,
gettext_noop("Sets the file name pattern for log files."),
NULL
},
&Log_filename_prefix,
"postgresql-", NULL, NULL
&Log_filename,
"postgresql-%Y-%m-%d_%H%M%S.log", NULL, NULL
},
#ifdef HAVE_SYSLOG

View File

@@ -171,9 +171,17 @@
# This is relevant when logging to stderr:
#redirect_stderr = false # Enable capturing of stderr into log files.
# These are only relevant if redirect_stderr is true:
#log_directory = 'pg_log' # Directory where logfiles are written.
#log_directory = 'pg_log' # Directory where log files are written.
# May be specified absolute or relative to PGDATA
#log_filename_prefix = 'postgresql_' # Prefix for logfile names.
#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # Log file name pattern.
# May include strftime() escapes
#log_truncate_on_rotation = false # If true, any existing log file of the
# same name as the new log file will be truncated
# rather than appended to. But such truncation
# only occurs on time-driven rotation,
# not on restarts or size-driven rotation.
# Default is false, meaning append to existing
# files in all cases.
#log_rotation_age = 1440 # Automatic rotation of logfiles will happen after
# so many minutes. 0 to disable.
#log_rotation_size = 10240 # Automatic rotation of logfiles will happen after