summaryrefslogtreecommitdiff
path: root/win32/wsyslog.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2004-07-31 23:59:46 +0000
committerWez Furlong <wez@php.net>2004-07-31 23:59:46 +0000
commit2c9d87c2f684b9b574b478d1f921fc056853a488 (patch)
treedb95ad8a5dfa10747b06c277ea74d477b3dfee22 /win32/wsyslog.c
parentd45d690164d6c03c858bb375ea74a85694812fa9 (diff)
downloadphp-git-2c9d87c2f684b9b574b478d1f921fc056853a488.tar.gz
Fix bug #8314: sane syslog output to the WinNT event log.
Big fat note: if you're building from a .dsp, you need to replicate the custom build step that uses MC to generate the message catalog To make use of this fix, you need to register the event source; running "nmake install" will handle this for you (if you also build the win32std extension from pecl). I'll arrange with Phil to have the installer handle this registration too.
Diffstat (limited to 'win32/wsyslog.c')
-rw-r--r--win32/wsyslog.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/win32/wsyslog.c b/win32/wsyslog.c
index ca1e45b9ca..294b3976c4 100644
--- a/win32/wsyslog.c
+++ b/win32/wsyslog.c
@@ -57,6 +57,7 @@
#include <process.h>
#include "php_win32_globals.h"
+#include "wsyslog.h"
void closelog(void)
{
@@ -78,6 +79,7 @@ void syslog(int priority, const char *message, ...)
LPTSTR strs[2];
unsigned short etype;
char *tmp = NULL;
+ DWORD evid;
TSRMLS_FETCH();
/* default event source */
@@ -87,19 +89,22 @@ void syslog(int priority, const char *message, ...)
switch (priority) { /* translate UNIX type into NT type */
case LOG_ALERT:
etype = EVENTLOG_ERROR_TYPE;
+ evid = PHP_SYSLOG_ERROR_TYPE;
break;
case LOG_INFO:
etype = EVENTLOG_INFORMATION_TYPE;
+ evid = PHP_SYSLOG_INFO_TYPE;
break;
default:
etype = EVENTLOG_WARNING_TYPE;
+ evid = PHP_SYSLOG_WARNING_TYPE;
}
va_start(args, message); /* initialize vararg mechanism */
vspprintf(&tmp, 0, message, args); /* build message */
strs[0] = PW32G(log_header); /* write header */
strs[1] = tmp; /* then the message */
/* report the event */
- ReportEvent(PW32G(log_source), etype, (unsigned short) priority, 2000, NULL, 2, 0, strs, NULL);
+ ReportEvent(PW32G(log_source), etype, (unsigned short) priority, evid, NULL, 2, 0, strs, NULL);
va_end(args);
efree(tmp);
}
@@ -121,6 +126,6 @@ void openlog(const char *ident, int logopt, int facility)
STR_FREE(PW32G(log_header));
- PW32G(log_source) = RegisterEventSource(NULL, ident);
+ PW32G(log_source) = RegisterEventSource(NULL, "PHP-" PHP_VERSION);
spprintf(&PW32G(log_header), 0, (logopt & LOG_PID) ? "%s[%d]" : "%s", ident, getpid());
}