Skip to content

Commit da89136

Browse files
committed
added:storage log support
1 parent 20d67a7 commit da89136

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

XEngine_Source/AuthorizeModule_Configure/Config_Define.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,12 @@ typedef struct
103103
struct
104104
{
105105
XCHAR tszLogFile[XPATH_MAX]; //日志文件
106+
XCHAR tszKeyFile[XPATH_MAX];
106107
int nMaxSize; //最大大小
107108
int nMaxCount; //备份个数
108109
int nLogLeave; //日志级别
109110
int nLogType; //日志类型
111+
bool bLogStorage; //强日志
110112
}st_XLog;
111113
struct
112114
{

XEngine_Source/AuthorizeModule_Configure/ModuleConfigure_Json/ModuleConfigure_Json.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
173173
_tcsxcpy(pSt_ServerConfig->st_XSql.st_MYSQL.tszSQLUser, st_JsonXSql["SQLUser"].asCString());
174174
_tcsxcpy(pSt_ServerConfig->st_XSql.st_MYSQL.tszSQLPass, st_JsonXSql["SQLPass"].asCString());
175175
//日志配置
176-
if (st_JsonRoot["XLog"].empty() || (5 != st_JsonRoot["XLog"].size()))
176+
if (st_JsonRoot["XLog"].empty() || (7 != st_JsonRoot["XLog"].size()))
177177
{
178178
Config_IsErrorOccur = true;
179179
Config_dwErrorCode = ERROR_AUTHORIZE_MODULE_CONFIGURE_XLOG;
@@ -184,8 +184,10 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
184184
pSt_ServerConfig->st_XLog.nMaxCount = st_JsonXLog["MaxCount"].asInt();
185185
pSt_ServerConfig->st_XLog.nLogLeave = st_JsonXLog["LogLeave"].asInt();
186186
pSt_ServerConfig->st_XLog.nLogType = st_JsonXLog["nLogType"].asInt();
187+
pSt_ServerConfig->st_XLog.bLogStorage = st_JsonXLog["bLogStorage"].asBool();
187188
_tcsxcpy(pSt_ServerConfig->st_XLog.tszLogFile, st_JsonXLog["tszLogFile"].asCString());
188-
189+
_tcsxcpy(pSt_ServerConfig->st_XLog.tszKeyFile, st_JsonXLog["tszKeyFile"].asCString());
190+
189191
if (st_JsonRoot["XReport"].empty() || (3 != st_JsonRoot["XReport"].size()))
190192
{
191193
Config_IsErrorOccur = true;

XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ void ServiceApp_Stop(int signo)
4848
ManagePool_Thread_NQDestroy(xhHttpPool);
4949
ManagePool_Memory_Destory(xhMemPool);
5050

51+
HelpComponents_XLog_StrongClose(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_NOTICE);
5152
HelpComponents_XLog_Destroy(xhLog);
5253
Session_Authorize_Destroy();
5354
Session_Token_Destroy();
@@ -163,7 +164,11 @@ int main(int argc, char** argv)
163164
}
164165
HelpComponents_XLog_SetLogPriority(xhLog, st_AuthConfig.st_XLog.nLogLeave);
165166
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化日志系统成功,日志文件:%s"), st_AuthConfig.st_XLog.tszLogFile);
166-
167+
if (st_AuthConfig.st_XLog.bLogStorage)
168+
{
169+
HelpComponents_XLog_StrongOPen(xhLog, st_AuthConfig.st_XLog.tszKeyFile, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_NOTICE);
170+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化关键日志存储功能成功..."));
171+
}
167172
if (st_AuthConfig.bDeamon)
168173
{
169174
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,使用守护进程启动服务..."));
@@ -476,6 +481,7 @@ int main(int argc, char** argv)
476481
ManagePool_Thread_NQDestroy(xhHttpPool);
477482
ManagePool_Memory_Destory(xhMemPool);
478483

484+
HelpComponents_XLog_StrongClose(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_NOTICE);
479485
HelpComponents_XLog_Destroy(xhLog);
480486
Session_Authorize_Destroy();
481487
Session_Token_Destroy();

0 commit comments

Comments
 (0)