<title>Options for Windows</title>
<variablelist>
+ <varlistentry>
+ <term><option>-e <replaceable class="parameter">source</replaceable></option></term>
+ <listitem>
+ <para>
+ Name of the event source for <application>pg_ctl</application> to use
+ for logging to the event log when running as a Windows service. The
+ default is <literal>PostgreSQL</literal>. Note that this only controls
+ the logging from <application>pg_ctl</application> itself - once
+ started, the server will use the event source specified
+ by <xref linkend="guc-event-source">. Should the server fail during
+ early startup, it may also log using the default event
+ source <literal>PostgreSQL</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>-N <replaceable class="parameter">servicename</replaceable></option></term>
<listitem>
static const char *progname;
static char *log_file = NULL;
static char *exec_path = NULL;
+static char *event_source = NULL;
static char *register_servicename = "PostgreSQL"; /* FIXME: + version ID? */
static char *register_username = NULL;
static char *register_password = NULL;
if (evtHandle == INVALID_HANDLE_VALUE)
{
- evtHandle = RegisterEventSource(NULL, "PostgreSQL");
+ evtHandle = RegisterEventSource(NULL,
+ event_source ? event_source : DEFAULT_EVENT_SOURCE);
if (evtHandle == NULL)
{
evtHandle = INVALID_HANDLE_VALUE;
free(dataDir);
}
+ if (registration && event_source != NULL)
+ appendPQExpBuffer(cmdLine, " -e \"%s\"", event_source);
+
if (registration && do_wait)
appendPQExpBuffer(cmdLine, " -w");
printf(_("\nCommon options:\n"));
printf(_(" -D, --pgdata=DATADIR location of the database storage area\n"));
printf(_(" -s, --silent only print errors, no informational messages\n"));
+#if defined(WIN32) || defined(__CYGWIN__)
+ printf(_(" -e SOURCE event source to use for logging when running\n"
+ " as a service\n"));
+#endif
printf(_(" -t, --timeout=SECS seconds to wait when using -w option\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -w wait until operation completes\n"));
/* process command-line options */
while (optind < argc)
{
- while ((c = getopt_long(argc, argv, "cD:l:m:N:o:p:P:sS:t:U:wW", long_options, &option_index)) != -1)
+ while ((c = getopt_long(argc, argv, "cD:e:l:m:N:o:p:P:sS:t:U:wW", long_options, &option_index)) != -1)
{
switch (c)
{
case 'm':
set_mode(optarg);
break;
+ case 'e':
+ event_source = pg_strdup(optarg);
+ break;
case 'N':
register_servicename = pg_strdup(optarg);
break;