summaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/error/elog.c9
-rw-r--r--src/backend/utils/misc/guc.c68
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample14
3 files changed, 77 insertions, 14 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 340cca03cac..9723cf76f59 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.145 2004/08/04 20:58:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.146 2004/08/05 23:32:11 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,6 +57,7 @@
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "postmaster/postmaster.h"
+#include "postmaster/syslogger.h"
#include "storage/ipc.h"
#include "tcop/tcopprot.h"
#include "utils/memutils.h"
@@ -71,7 +72,7 @@ sigjmp_buf *PG_exception_stack = NULL;
/* GUC parameters */
PGErrorVerbosity Log_error_verbosity = PGERROR_VERBOSE;
char *Log_line_prefix = NULL; /* format for extra log line info */
-unsigned int Log_destination = LOG_DESTINATION_STDERR;
+int Log_destination = LOG_DESTINATION_STDERR;
#ifdef HAVE_SYSLOG
char *Syslog_facility; /* openlog() parameters */
@@ -1589,6 +1590,10 @@ send_message_to_server_log(ErrorData *edata)
fprintf(stderr, "%s", buf.data);
}
+ /* If in the syslogger process, try to write messages direct to file */
+ if (am_syslogger)
+ write_syslogger_file(buf.data, buf.len);
+
pfree(buf.data);
}
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 22df3effc32..a827653bec4 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.225 2004/07/28 14:23:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.226 2004/08/05 23:32:12 tgl Exp $
*
*--------------------------------------------------------------------
*/
@@ -44,6 +44,7 @@
#include "parser/parse_expr.h"
#include "parser/parse_relation.h"
#include "postmaster/bgwriter.h"
+#include "postmaster/syslogger.h"
#include "postmaster/postmaster.h"
#include "storage/bufmgr.h"
#include "storage/fd.h"
@@ -801,19 +802,13 @@ static struct config_bool ConfigureNamesBool[] =
&default_with_oids,
true, NULL, NULL
},
-
{
- {"integer_datetimes", PGC_INTERNAL, COMPILE_OPTIONS,
- gettext_noop("Datetimes are integer based"),
- NULL,
- GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
+ {"redirect_stderr", PGC_POSTMASTER, LOGGING_WHERE,
+ gettext_noop("Start a subprocess to capture stderr output into log files"),
+ NULL
},
- &integer_datetimes,
-#ifdef HAVE_INT64_TIMESTAMP
- true, NULL, NULL
-#else
+ &Redirect_stderr,
false, NULL, NULL
-#endif
},
#ifdef WAL_DEBUG
@@ -828,6 +823,20 @@ static struct config_bool ConfigureNamesBool[] =
},
#endif
+ {
+ {"integer_datetimes", PGC_INTERNAL, COMPILE_OPTIONS,
+ gettext_noop("Datetimes are integer based"),
+ NULL,
+ GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
+ },
+ &integer_datetimes,
+#ifdef HAVE_INT64_TIMESTAMP
+ true, NULL, NULL
+#else
+ false, NULL, NULL
+#endif
+ },
+
/* End-of-list marker */
{
{NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL
@@ -1246,6 +1255,24 @@ static struct config_int ConfigureNamesInt[] =
},
{
+ {"log_rotation_age", PGC_SIGHUP, LOGGING_WHERE,
+ gettext_noop("Automatic logfile rotation will occur after N minutes"),
+ NULL
+ },
+ &Log_RotationAge,
+ 24*60, 0, INT_MAX, NULL, NULL
+ },
+
+ {
+ {"log_rotation_size", PGC_SIGHUP, LOGGING_WHERE,
+ gettext_noop("Automatic logfile rotation will occur after N kilobytes"),
+ NULL
+ },
+ &Log_RotationSize,
+ 10*1024, 0, INT_MAX, NULL, NULL
+ },
+
+ {
{"max_function_args", PGC_INTERNAL, COMPILE_OPTIONS,
gettext_noop("Shows the maximum number of function arguments"),
NULL,
@@ -1634,6 +1661,23 @@ static struct config_string ConfigureNamesString[] =
&log_destination_string,
"stderr", assign_log_destination, NULL
},
+ {
+ {"log_directory", PGC_SIGHUP, LOGGING_WHERE,
+ gettext_noop("Sets the destination directory for logfiles."),
+ gettext_noop("May be specified as relative to the cluster directory "
+ "or as absolute path.")
+ },
+ &Log_directory,
+ "pg_log", NULL, NULL
+ },
+ {
+ {"log_filename_prefix", PGC_SIGHUP, LOGGING_WHERE,
+ gettext_noop("Prefix for file names created in the log_directory."),
+ NULL
+ },
+ &Log_filename_prefix,
+ "postgresql-", NULL, NULL
+ },
#ifdef HAVE_SYSLOG
{
@@ -5055,7 +5099,7 @@ assign_log_destination(const char *value, bool doit, GucSource source)
char *rawstring;
List *elemlist;
ListCell *l;
- unsigned int newlogdest = 0;
+ int newlogdest = 0;
/* Need a modifiable copy of string */
rawstring = pstrdup(value);
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 9dc1ec8d837..633bb5a3229 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -170,9 +170,23 @@
#log_destination = 'stderr' # Valid values are combinations of stderr,
# syslog and eventlog, depending on
# platform.
+
+# 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.
+ # May be specified absolute or relative to PGDATA
+#log_filename_prefix = 'postgresql_' # Prefix for logfile names.
+#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
+ # so many kilobytes of log output. 0 to disable.
+
+# These are relevant when logging to syslog:
#syslog_facility = 'LOCAL0'
#syslog_ident = 'postgres'
+
# - When to Log -
#client_min_messages = notice # Values, in order of decreasing detail: