Commit 0937bf95 authored by Peter Eisentraut's avatar Peter Eisentraut

Small polishing of syslog facility and ident settings. Only allow setting

at postmaster start, rename syslog_progid to syslog_ident, since syslog
itself uses that term, fix doc markup.
parent 2cf48ca0
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.35 2000/11/14 18:11:30 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.36 2000/11/14 19:13:26 petere Exp $
--> -->
<Chapter Id="runtime"> <Chapter Id="runtime">
...@@ -825,22 +825,25 @@ env PGOPTIONS='-c geqo=off' psql ...@@ -825,22 +825,25 @@ env PGOPTIONS='-c geqo=off' psql
<term>SYSLOG_FACILITY (<type>string</type>)</term> <term>SYSLOG_FACILITY (<type>string</type>)</term>
<listitem> <listitem>
<para> <para>
If the SYSLOG option is set to 1 or greater, this option determines This option determines the <application>syslog</application>
the <application>syslog</application> facility used. You may choose <quote>facility</quote> to be used when syslog is enabled.
from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. You may choose from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4,
the default is LOCAL0 LOCAL5, LOCAL6, LOCAL7; the default is LOCAL0. See also the
documentation of your system's
<application>syslog</application>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>SYSLOG_PROGID (<type>string</type>)</term> <term>SYSLOG_IDENT (<type>string</type>)</term>
<listitem> <listitem>
<para> <para>
If the SYSLOG option is set to 1 or greater, this option determines If logging to syslog is enabled, this option determines the
the program id used to identify <product>PostgreSQL</product> messages program name used to identify
in <application>syslog</application> log messages. The default is <productname>PostgreSQL</productname> messages in
postgres. <application>syslog</application> log messages. The default
is <quote>postgres</quote>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.66 2000/11/13 21:35:02 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.67 2000/11/14 19:13:27 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -58,8 +58,8 @@ extern CommandDest whereToSendOutput; ...@@ -58,8 +58,8 @@ extern CommandDest whereToSendOutput;
* ... in theory anyway * ... in theory anyway
*/ */
int Use_syslog = 0; int Use_syslog = 0;
char *Syslog_facility = "LOCAL0"; char *Syslog_facility;
char *Syslog_progid = "postgres"; char *Syslog_ident;
static void write_syslog(int level, const char *line); static void write_syslog(int level, const char *line);
...@@ -646,7 +646,7 @@ write_syslog(int level, const char *line) ...@@ -646,7 +646,7 @@ write_syslog(int level, const char *line)
syslog_fac = LOG_LOCAL6; syslog_fac = LOG_LOCAL6;
if (strcasecmp(Syslog_facility,"LOCAL7") == 0) if (strcasecmp(Syslog_facility,"LOCAL7") == 0)
syslog_fac = LOG_LOCAL7; syslog_fac = LOG_LOCAL7;
openlog(Syslog_progid, LOG_PID | LOG_NDELAY, syslog_fac); openlog(Syslog_ident, LOG_PID | LOG_NDELAY, syslog_fac);
openlog_done = true; openlog_done = true;
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Support for grand unified configuration scheme, including SET * Support for grand unified configuration scheme, including SET
* command, configuration file, and command line options. * command, configuration file, and command line options.
* *
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.19 2000/11/14 01:15:02 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.20 2000/11/14 19:13:27 petere Exp $
* *
* Copyright 2000 by PostgreSQL Global Development Group * Copyright 2000 by PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>. * Written by Peter Eisentraut <peter_e@gmx.net>.
...@@ -41,8 +41,8 @@ extern int XLOGbuffers; ...@@ -41,8 +41,8 @@ extern int XLOGbuffers;
extern int XLOG_DEBUG; extern int XLOG_DEBUG;
#ifdef ENABLE_SYSLOG #ifdef ENABLE_SYSLOG
extern char *Syslog_facility; extern char *Syslog_facility;
extern char *Syslog_progid; extern char *Syslog_ident;
bool check_facility(const char *facility); bool check_facility(const char *facility);
#endif #endif
/* /*
...@@ -308,10 +308,11 @@ ConfigureNamesString[] = ...@@ -308,10 +308,11 @@ ConfigureNamesString[] =
{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group, {"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group,
"", NULL}, "", NULL},
#ifdef ENABLE_SYSLOG #ifdef ENABLE_SYSLOG
{"syslog_facility", PGC_SIGHUP, &Syslog_facility, {"syslog_facility", PGC_POSTMASTER, &Syslog_facility,
"LOCAL0", check_facility}, "LOCAL0", check_facility},
{"syslog_progid", PGC_SIGHUP, &Syslog_progid, {"syslog_ident", PGC_POSTMASTER, &Syslog_ident,
"postgres", NULL}, "postgres", NULL},
#endif #endif
...@@ -608,7 +609,7 @@ set_config_option(const char * name, const char * value, GucContext ...@@ -608,7 +609,7 @@ set_config_option(const char * name, const char * value, GucContext
bool boolval; bool boolval;
if (!parse_bool(value, &boolval)) if (!parse_bool(value, &boolval))
{ {
elog(elevel, "Option '%s' requires a boolean value", name); elog(elevel, "option '%s' requires a boolean value", name);
return false; return false;
} }
if (DoIt) if (DoIt)
...@@ -629,12 +630,12 @@ set_config_option(const char * name, const char * value, GucContext ...@@ -629,12 +630,12 @@ set_config_option(const char * name, const char * value, GucContext
if (!parse_int(value, &intval)) if (!parse_int(value, &intval))
{ {
elog(elevel, "Option '%s' expects an integer value", name); elog(elevel, "option '%s' expects an integer value", name);
return false; return false;
} }
if (intval < conf->min || intval > conf->max) if (intval < conf->min || intval > conf->max)
{ {
elog(elevel, "Option '%s' value %d is outside" elog(elevel, "option '%s' value %d is outside"
" of permissible range [%d .. %d]", " of permissible range [%d .. %d]",
name, intval, conf->min, conf->max); name, intval, conf->min, conf->max);
return false; return false;
...@@ -657,12 +658,12 @@ set_config_option(const char * name, const char * value, GucContext ...@@ -657,12 +658,12 @@ set_config_option(const char * name, const char * value, GucContext
if (!parse_real(value, &dval)) if (!parse_real(value, &dval))
{ {
elog(elevel, "Option '%s' expects a real number", name); elog(elevel, "option '%s' expects a real number", name);
return false; return false;
} }
if (dval < conf->min || dval > conf->max) if (dval < conf->min || dval > conf->max)
{ {
elog(elevel, "Option '%s' value %g is outside" elog(elevel, "option '%s' value %g is outside"
" of permissible range [%g .. %g]", " of permissible range [%g .. %g]",
name, dval, conf->min, conf->max); name, dval, conf->min, conf->max);
return false; return false;
...@@ -683,7 +684,7 @@ set_config_option(const char * name, const char * value, GucContext ...@@ -683,7 +684,7 @@ set_config_option(const char * name, const char * value, GucContext
{ {
if (conf->parse_hook && !(conf->parse_hook)(value)) if (conf->parse_hook && !(conf->parse_hook)(value))
{ {
elog(elevel, "Option '%s' rejects value '%s'", name, value); elog(elevel, "invalid value for option '%s': '%s'", name, value);
return false; return false;
} }
if (DoIt) if (DoIt)
...@@ -824,6 +825,9 @@ ParseLongOption(const char * string, char ** name, char ** value) ...@@ -824,6 +825,9 @@ ParseLongOption(const char * string, char ** name, char ** value)
if (*cp == '-') if (*cp == '-')
*cp = '_'; *cp = '_';
} }
#ifdef ENABLE_SYSLOG #ifdef ENABLE_SYSLOG
bool bool
check_facility(const char *facility) check_facility(const char *facility)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment