diff options
| author | Bruce Momjian <bruce@momjian.us> | 2000-11-13 21:35:03 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2000-11-13 21:35:03 +0000 |
| commit | d63a762f799b08c28190ad3ae5ab4061aa83e762 (patch) | |
| tree | 6bec476150feaad39e948333af5d12d0bd959966 /src/backend/utils/error/elog.c | |
| parent | b557be50a05953267055376c92b139e951814239 (diff) | |
| download | postgresql-d63a762f799b08c28190ad3ae5ab4061aa83e762.tar.gz | |
Ok, You guys are probably tired of me, BUT, here is another one, that
adds the facility to set the program name used in syslog.
(this includes the other ones).
One gotcha, the parser doesn't like special characters in strings.
For example, i tried to use pg-test, and if failed the parse coming
from the postgresql.conf file.
I don't think it's a showstopper..
Larry Rosenman
Diffstat (limited to 'src/backend/utils/error/elog.c')
| -rw-r--r-- | src/backend/utils/error/elog.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 3f80c21580..89aeacb5ff 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.65 2000/10/30 06:48:36 ishii Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.66 2000/11/13 21:35:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -58,6 +58,8 @@ extern CommandDest whereToSendOutput; * ... in theory anyway */ int Use_syslog = 0; +char *Syslog_facility = "LOCAL0"; +char *Syslog_progid = "postgres"; static void write_syslog(int level, const char *line); @@ -620,6 +622,7 @@ write_syslog(int level, const char *line) static bool openlog_done = false; static unsigned long seq = 0; + static int syslog_fac = LOG_LOCAL0; int len = strlen(line); if (Use_syslog == 0) @@ -627,7 +630,23 @@ write_syslog(int level, const char *line) if (!openlog_done) { - openlog("postgres", LOG_PID | LOG_NDELAY, LOG_LOCAL0); + if (strcasecmp(Syslog_facility,"LOCAL0") == 0) + syslog_fac = LOG_LOCAL0; + if (strcasecmp(Syslog_facility,"LOCAL1") == 0) + syslog_fac = LOG_LOCAL1; + if (strcasecmp(Syslog_facility,"LOCAL2") == 0) + syslog_fac = LOG_LOCAL2; + if (strcasecmp(Syslog_facility,"LOCAL3") == 0) + syslog_fac = LOG_LOCAL3; + if (strcasecmp(Syslog_facility,"LOCAL4") == 0) + syslog_fac = LOG_LOCAL4; + if (strcasecmp(Syslog_facility,"LOCAL5") == 0) + syslog_fac = LOG_LOCAL5; + if (strcasecmp(Syslog_facility,"LOCAL6") == 0) + syslog_fac = LOG_LOCAL6; + if (strcasecmp(Syslog_facility,"LOCAL7") == 0) + syslog_fac = LOG_LOCAL7; + openlog(Syslog_progid, LOG_PID | LOG_NDELAY, syslog_fac); openlog_done = true; } |
