aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2011-10-25 20:02:55 +0200
committerMagnus Hagander <magnus@hagander.net>2011-10-25 20:02:55 +0200
commitd8ea33f2c02721c89c2434b9fda170afb7fe4999 (patch)
tree9c319e8fc813e7df07fe5cfeca501b1364d1e991 /src/backend
parent90d8e8ff7ee94283270cc7b2bc6a986a7cd174fc (diff)
downloadpostgresql-d8ea33f2c02721c89c2434b9fda170afb7fe4999.tar.gz
postgresql-d8ea33f2c02721c89c2434b9fda170afb7fe4999.zip
Support configurable eventlog application names on Windows
This allows different instances to use the eventlog with different identifiers, by setting the event_source GUC, similar to how syslog_ident works. Original patch by MauMau, heavily modified by Magnus Hagander
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/utils/error/elog.c3
-rw-r--r--src/backend/utils/misc/guc.c14
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample2
3 files changed, 18 insertions, 1 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 7122b59b96a..9a99fc7402b 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -123,6 +123,7 @@ static void write_syslog(int level, const char *line);
static void write_console(const char *line, int len);
#ifdef WIN32
+extern char *event_source;
static void write_eventlog(int level, const char *line, int len);
#endif
@@ -1673,7 +1674,7 @@ write_eventlog(int level, const char *line, int len)
if (evtHandle == INVALID_HANDLE_VALUE)
{
- evtHandle = RegisterEventSource(NULL, "PostgreSQL");
+ evtHandle = RegisterEventSource(NULL, event_source ? event_source : "PostgreSQL");
if (evtHandle == NULL)
{
evtHandle = INVALID_HANDLE_VALUE;
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 73e60010711..0b1c912fb3a 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -412,6 +412,7 @@ bool log_executor_stats = false;
bool log_statement_stats = false; /* this is sort of all three
* above together */
bool log_btree_build_stats = false;
+char *event_source;
bool check_function_bodies = true;
bool default_with_oids = false;
@@ -2819,6 +2820,19 @@ static struct config_string ConfigureNamesString[] =
NULL, assign_syslog_ident, NULL
},
+#ifdef WIN32
+ {
+ {"event_source", PGC_POSTMASTER, LOGGING_WHERE,
+ gettext_noop("Sets the application name used to identify"
+ "PostgreSQL messages in the event log."),
+ NULL
+ },
+ &event_source,
+ "PostgreSQL",
+ NULL, NULL, NULL
+ },
+#endif
+
{
{"TimeZone", PGC_USERSET, CLIENT_CONN_LOCALE,
gettext_noop("Sets the time zone for displaying and interpreting time stamps."),
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 67b098bd6d7..315db466341 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -322,6 +322,8 @@
#syslog_facility = 'LOCAL0'
#syslog_ident = 'postgres'
+# This is only relevant when logging to eventlog (win32):
+#event_source = 'PostgreSQL'
# - When to Log -