Issue #95: Adding ability to specify custom service name/have multiple Redis service instances running.(Forgive the whitespace changes in Win32_Service.cpp. My editor was set to keep tabs when I wrote the code originally. Tabs are gone now.)
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -128,7 +128,8 @@ void RedisEventLog::LogMessageToEventLog(LPCSTR msg, const WORD type) {
|
||||
extern "C" void WriteEventLog(const char* sysLogInstance, const char* msg) {
|
||||
try {
|
||||
stringstream ss;
|
||||
ss << sysLogInstance << ":: " << msg;
|
||||
ss << "syslog-ident = " << sysLogInstance << endl;
|
||||
ss << msg;
|
||||
RedisEventLog().LogMessageToEventLog(ss.str().c_str(),EVENTLOG_INFORMATION_TYPE);
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ extern "C"
|
||||
#endif
|
||||
|
||||
BOOL RunningAsService();
|
||||
BOOL HandleServiceCommands(int argc, char **argv);
|
||||
const char* GetServiceName();
|
||||
BOOL HandleServiceCommands(int argc, char **argv);
|
||||
BOOL ServiceStopIssued();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
+462
-425
File diff suppressed because it is too large
Load Diff
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "Win32_FDAPI.h"
|
||||
#include "Win32_QFork.h"
|
||||
#include "Win32_Service.h"
|
||||
|
||||
#define fseeko fseeko64
|
||||
#define ftello ftello64
|
||||
|
||||
+8
-2
@@ -1321,11 +1321,17 @@ void initServerConfig() {
|
||||
server.loading = 0;
|
||||
server.logfile = zstrdup(REDIS_DEFAULT_LOGFILE);
|
||||
#ifdef _WIN32
|
||||
server.syslog_enabled = RunningAsService() ? 1 : REDIS_DEFAULT_SYSLOG_ENABLED;
|
||||
if (RunningAsService()) {
|
||||
server.syslog_enabled = 1;
|
||||
server.syslog_ident = zstrdup(GetServiceName());
|
||||
} else {
|
||||
server.syslog_ident = zstrdup(REDIS_DEFAULT_SYSLOG_IDENT);
|
||||
server.syslog_enabled = REDIS_DEFAULT_SYSLOG_ENABLED;
|
||||
}
|
||||
#else
|
||||
server.syslog_enabled = REDIS_DEFAULT_SYSLOG_ENABLED;
|
||||
#endif
|
||||
server.syslog_ident = zstrdup(REDIS_DEFAULT_SYSLOG_IDENT);
|
||||
#endif
|
||||
server.syslog_facility = LOG_LOCAL0;
|
||||
server.daemonize = REDIS_DEFAULT_DAEMONIZE;
|
||||
server.aof_state = REDIS_AOF_OFF;
|
||||
|
||||
Reference in New Issue
Block a user