提交 9f871c4e 编写于 作者: J jonathan pickett

Issue #95: Adding ability to specify custom service name/have multiple Redis...

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.)
上级 de0a37aa
......@@ -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
......
此差异已折叠。
......@@ -36,6 +36,7 @@
#include "Win32_FDAPI.h"
#include "Win32_QFork.h"
#include "Win32_Service.h"
#define fseeko fseeko64
#define ftello ftello64
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册