Skip to content

Commit 4cb36e3

Browse files
committed
added:log file and type configure set support
1 parent def655e commit 4cb36e3

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

XEngine_Release/XEngine_Config/XEngine_Config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
"nWebdavTimeOut":5
2424
},
2525
"XLog":{
26+
"LogFile":"./XEngine_XLog/XEngine_StorageApp.log",
2627
"MaxSize":1024000,
2728
"MaxCount":10,
28-
"LogLeave":32
29+
"LogLeave":32,
30+
"LogType":17
2931
},
3032
"XSql":{
3133
"SQLEnable":false,

XEngine_Source/StorageModule_Config/Config_Define.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ typedef struct tag_XEngine_ServerConfig
4747
}st_XTime;
4848
struct
4949
{
50+
XCHAR tszLogFile[MAX_PATH];
5051
int nMaxSize;
5152
int nMaxCount;
5253
int nLogLeave;
54+
int nLogType;
5355
}st_XLog;
5456
struct
5557
{

XEngine_Source/StorageModule_Config/Config_Json/Config_Json.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ bool CConfig_Json::Config_Json_File(LPCXSTR lpszConfigFile, XENGINE_SERVERCONFIG
117117
pSt_ServerConfig->st_XTime.nStorageTimeOut = st_JsonXTime["nStorageTimeOut"].asInt();
118118
pSt_ServerConfig->st_XTime.nWebdavTimeOut = st_JsonXTime["nWebdavTimeOut"].asInt();
119119

120-
if (st_JsonRoot["XLog"].empty() || (3 != st_JsonRoot["XLog"].size()))
120+
if (st_JsonRoot["XLog"].empty() || (5 != st_JsonRoot["XLog"].size()))
121121
{
122122
Config_IsErrorOccur = true;
123123
Config_dwErrorCode = ERROR_XENGINE_BLOGIC_CONFIG_JSON_XLOG;
@@ -127,6 +127,8 @@ bool CConfig_Json::Config_Json_File(LPCXSTR lpszConfigFile, XENGINE_SERVERCONFIG
127127
pSt_ServerConfig->st_XLog.nMaxSize = st_JsonXLog["MaxSize"].asInt();
128128
pSt_ServerConfig->st_XLog.nMaxCount = st_JsonXLog["MaxCount"].asInt();
129129
pSt_ServerConfig->st_XLog.nLogLeave = st_JsonXLog["LogLeave"].asInt();
130+
pSt_ServerConfig->st_XLog.nLogType = st_JsonXLog["LogType"].asInt();
131+
_tcsxcpy(pSt_ServerConfig->st_XLog.tszLogFile, st_JsonXLog["LogFile"].asCString());
130132

131133
if (st_JsonRoot["XSql"].empty() || (5 != st_JsonRoot["XSql"].size()))
132134
{

XEngine_Source/XEngine_StorageApp/XEngine_StorageApp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ int main(int argc, char** argv)
191191
}
192192
st_XLogConfig.XLog_MaxBackupFile = st_ServiceCfg.st_XLog.nMaxCount;
193193
st_XLogConfig.XLog_MaxSize = st_ServiceCfg.st_XLog.nMaxSize;
194-
_tcsxcpy(st_XLogConfig.tszFileName, _X("./XEngine_XLog/XEngine_StorageApp.log"));
194+
_tcsxcpy(st_XLogConfig.tszFileName, st_ServiceCfg.st_XLog.tszLogFile);
195195

196-
xhLog = HelpComponents_XLog_Init(HELPCOMPONENTS_XLOG_OUTTYPE_FILE | HELPCOMPONENTS_XLOG_OUTTYPE_STD, &st_XLogConfig);
196+
xhLog = HelpComponents_XLog_Init(st_ServiceCfg.st_XLog.nLogType, &st_XLogConfig);
197197
if (NULL == xhLog)
198198
{
199199
printf("启动服务器失败,启动日志失败,错误:%lX", XLog_GetLastError());

0 commit comments

Comments
 (0)