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

Commit 0937bf9

Browse files
committed
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.
1 parent 2cf48ca commit 0937bf9

File tree

3 files changed

+32
-25
lines changed

3 files changed

+32
-25
lines changed

doc/src/sgml/runtime.sgml

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.35 2000/11/14 18:11:30 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.36 2000/11/14 19:13:26 petere Exp $
33
-->
44

55
<Chapter Id="runtime">
@@ -825,22 +825,25 @@ env PGOPTIONS='-c geqo=off' psql
825825
<term>SYSLOG_FACILITY (<type>string</type>)</term>
826826
<listitem>
827827
<para>
828-
If the SYSLOG option is set to 1 or greater, this option determines
829-
the <application>syslog</application> facility used. You may choose
830-
from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
831-
the default is LOCAL0
828+
This option determines the <application>syslog</application>
829+
<quote>facility</quote> to be used when syslog is enabled.
830+
You may choose from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4,
831+
LOCAL5, LOCAL6, LOCAL7; the default is LOCAL0. See also the
832+
documentation of your system's
833+
<application>syslog</application>.
832834
</para>
833835
</listitem>
834836
</varlistentry>
835837

836838
<varlistentry>
837-
<term>SYSLOG_PROGID (<type>string</type>)</term>
839+
<term>SYSLOG_IDENT (<type>string</type>)</term>
838840
<listitem>
839841
<para>
840-
If the SYSLOG option is set to 1 or greater, this option determines
841-
the program id used to identify <product>PostgreSQL</product> messages
842-
in <application>syslog</application> log messages. The default is
843-
postgres.
842+
If logging to syslog is enabled, this option determines the
843+
program name used to identify
844+
<productname>PostgreSQL</productname> messages in
845+
<application>syslog</application> log messages. The default
846+
is <quote>postgres</quote>.
844847
</para>
845848
</listitem>
846849
</varlistentry>

src/backend/utils/error/elog.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.66 2000/11/13 21:35:02 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.67 2000/11/14 19:13:27 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -58,8 +58,8 @@ extern CommandDest whereToSendOutput;
5858
* ... in theory anyway
5959
*/
6060
int Use_syslog = 0;
61-
char *Syslog_facility = "LOCAL0";
62-
char *Syslog_progid = "postgres";
61+
char *Syslog_facility;
62+
char *Syslog_ident;
6363

6464
static void write_syslog(int level, const char *line);
6565

@@ -646,7 +646,7 @@ write_syslog(int level, const char *line)
646646
syslog_fac = LOG_LOCAL6;
647647
if (strcasecmp(Syslog_facility,"LOCAL7") == 0)
648648
syslog_fac = LOG_LOCAL7;
649-
openlog(Syslog_progid, LOG_PID | LOG_NDELAY, syslog_fac);
649+
openlog(Syslog_ident, LOG_PID | LOG_NDELAY, syslog_fac);
650650
openlog_done = true;
651651
}
652652

src/backend/utils/misc/guc.c

+15-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Support for grand unified configuration scheme, including SET
55
* command, configuration file, and command line options.
66
*
7-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.19 2000/11/14 01:15:02 momjian Exp $
7+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.20 2000/11/14 19:13:27 petere Exp $
88
*
99
* Copyright 2000 by PostgreSQL Global Development Group
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
@@ -41,8 +41,8 @@ extern int XLOGbuffers;
4141
extern int XLOG_DEBUG;
4242
#ifdef ENABLE_SYSLOG
4343
extern char *Syslog_facility;
44-
extern char *Syslog_progid;
45-
bool check_facility(const char *facility);
44+
extern char *Syslog_ident;
45+
bool check_facility(const char *facility);
4646
#endif
4747

4848
/*
@@ -308,10 +308,11 @@ ConfigureNamesString[] =
308308

309309
{"unix_socket_group", PGC_POSTMASTER, &Unix_socket_group,
310310
"", NULL},
311+
311312
#ifdef ENABLE_SYSLOG
312-
{"syslog_facility", PGC_SIGHUP, &Syslog_facility,
313+
{"syslog_facility", PGC_POSTMASTER, &Syslog_facility,
313314
"LOCAL0", check_facility},
314-
{"syslog_progid", PGC_SIGHUP, &Syslog_progid,
315+
{"syslog_ident", PGC_POSTMASTER, &Syslog_ident,
315316
"postgres", NULL},
316317
#endif
317318

@@ -608,7 +609,7 @@ set_config_option(const char * name, const char * value, GucContext
608609
bool boolval;
609610
if (!parse_bool(value, &boolval))
610611
{
611-
elog(elevel, "Option '%s' requires a boolean value", name);
612+
elog(elevel, "option '%s' requires a boolean value", name);
612613
return false;
613614
}
614615
if (DoIt)
@@ -629,12 +630,12 @@ set_config_option(const char * name, const char * value, GucContext
629630

630631
if (!parse_int(value, &intval))
631632
{
632-
elog(elevel, "Option '%s' expects an integer value", name);
633+
elog(elevel, "option '%s' expects an integer value", name);
633634
return false;
634635
}
635636
if (intval < conf->min || intval > conf->max)
636637
{
637-
elog(elevel, "Option '%s' value %d is outside"
638+
elog(elevel, "option '%s' value %d is outside"
638639
" of permissible range [%d .. %d]",
639640
name, intval, conf->min, conf->max);
640641
return false;
@@ -657,12 +658,12 @@ set_config_option(const char * name, const char * value, GucContext
657658

658659
if (!parse_real(value, &dval))
659660
{
660-
elog(elevel, "Option '%s' expects a real number", name);
661+
elog(elevel, "option '%s' expects a real number", name);
661662
return false;
662663
}
663664
if (dval < conf->min || dval > conf->max)
664665
{
665-
elog(elevel, "Option '%s' value %g is outside"
666+
elog(elevel, "option '%s' value %g is outside"
666667
" of permissible range [%g .. %g]",
667668
name, dval, conf->min, conf->max);
668669
return false;
@@ -683,7 +684,7 @@ set_config_option(const char * name, const char * value, GucContext
683684
{
684685
if (conf->parse_hook && !(conf->parse_hook)(value))
685686
{
686-
elog(elevel, "Option '%s' rejects value '%s'", name, value);
687+
elog(elevel, "invalid value for option '%s': '%s'", name, value);
687688
return false;
688689
}
689690
if (DoIt)
@@ -824,6 +825,9 @@ ParseLongOption(const char * string, char ** name, char ** value)
824825
if (*cp == '-')
825826
*cp = '_';
826827
}
828+
829+
830+
827831
#ifdef ENABLE_SYSLOG
828832
bool
829833
check_facility(const char *facility)

0 commit comments

Comments
 (0)