提交 460f7890 编写于 作者: S Shengliang Guan

log variables

上级 06a7ba7b
......@@ -23,7 +23,7 @@ extern "C" {
#endif
// log
extern int8_t tsAsyncLog;
extern bool tsAsyncLog;
extern int32_t tsNumOfLogLines;
extern int32_t tsLogKeepDays;
extern int32_t dDebugFlag;
......@@ -32,9 +32,6 @@ extern int32_t mDebugFlag;
extern int32_t cDebugFlag;
extern int32_t jniDebugFlag;
extern int32_t tmrDebugFlag;
extern int32_t httpDebugFlag;
extern int32_t mqttDebugFlag;
extern int32_t monDebugFlag;
extern int32_t uDebugFlag;
extern int32_t rpcDebugFlag;
extern int32_t qDebugFlag;
......@@ -42,8 +39,7 @@ extern int32_t wDebugFlag;
extern int32_t sDebugFlag;
extern int32_t tsdbDebugFlag;
extern int32_t tqDebugFlag;
extern int32_t cqDebugFlag;
extern int32_t debugFlag;
extern int32_t fsDebugFlag;
#define DEBUG_FATAL 1U
#define DEBUG_ERROR DEBUG_FATAL
......@@ -56,7 +52,7 @@ extern int32_t debugFlag;
#define DEBUG_SCREEN 64U
#define DEBUG_FILE 128U
int32_t taosInitLog(char *logName, int32_t numOfLogLines, int32_t maxFiles);
int32_t taosInitLog(const char *logName, int32_t maxFiles);
void taosCloseLog();
void taosResetLog();
......@@ -75,7 +71,7 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, .
void taosDumpData(unsigned char *msg, int32_t len);
void taosSetDebugFlag(int32_t flag);
void taosSetAllDebugFlag(int32_t flag);
#ifdef __cplusplus
}
......
......@@ -82,9 +82,7 @@ static void tscInitLogFile() {
const char *defaultLogFileNamePrefix = "taoslog";
const int32_t maxLogFileNum = 10;
char temp[128] = {0};
sprintf(temp, "%s/%s", tsLogDir, defaultLogFileNamePrefix);
if (taosInitLog(temp, tsNumOfLogLines, maxLogFileNum) < 0) {
if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) {
printf("failed to open log file in directory:%s\n", tsLogDir);
}
#endif
......
......@@ -178,22 +178,6 @@ char *qtypeStr[] = {"rpc", "fwd", "wal", "cq", "query"};
static pthread_once_t tsInitGlobalCfgOnce = PTHREAD_ONCE_INIT;
void taosSetAllDebugFlag() {
if (debugFlag != 0) {
mDebugFlag = debugFlag;
dDebugFlag = debugFlag;
vDebugFlag = debugFlag;
jniDebugFlag = debugFlag;
qDebugFlag = debugFlag;
rpcDebugFlag = debugFlag;
uDebugFlag = debugFlag;
sDebugFlag = debugFlag;
wDebugFlag = debugFlag;
tsdbDebugFlag = debugFlag;
cqDebugFlag = debugFlag;
uInfo("all debug flag are set to %d", debugFlag);
}
}
int32_t taosCfgDynamicOptions(char *msg) {
#if 0
......
......@@ -19,25 +19,24 @@
#include "config.h"
#include "dnode.h"
#include "taoserror.h"
#include "tglobal.h"
#include "ulog.h"
#include "taoserror.h"
#ifdef __cplusplus
extern "C" {
#endif
int32_t dmnInitLogCfg(SConfig *pCfg);
int32_t dmnAddLogCfg(SConfig *pCfg);
int32_t dmnInitLog(const char *cfgDir, const char *envFile, const char *apolloUrl);
int32_t dmnLoadCfg(SConfig *pConfig, const char *inputCfgDir, const char *envFile, const char *apolloUrl);
SConfig *dmnReadCfg(const char *cfgDir, const char *envFile, const char *apolloUrl);
SConfig *dmnReadCfg(const char *cfgDir, const char *envFile, const char *apolloUrl);
SDnodeEnvCfg dmnGetEnvCfg(SConfig *pCfg);
SDnodeObjCfg dmnGetObjCfg(SConfig *pCfg);
void dmnDumpCfg(SConfig *pCfg);
void dmnPrintVersion(SConfig *pCfg);
void dmnPrintVersion();
void dmnGenerateGrant();
#ifdef __cplusplus
......
......@@ -22,7 +22,6 @@ static struct {
bool generateGrant;
bool printAuth;
bool printVersion;
char configDir[PATH_MAX];
char envFile[PATH_MAX];
char apolloUrl[PATH_MAX];
} dmn = {0};
......@@ -48,8 +47,6 @@ static void dmnWaitSignal() {
}
static int32_t dmnParseOption(int32_t argc, char const *argv[]) {
tstrncpy(dmn.configDir, "/etc/taos", PATH_MAX);
for (int32_t i = 1; i < argc; ++i) {
if (strcmp(argv[i], "-c") == 0) {
if (i < argc - 1) {
......@@ -57,7 +54,7 @@ static int32_t dmnParseOption(int32_t argc, char const *argv[]) {
printf("config file path overflow");
return -1;
}
tstrncpy(dmn.configDir, argv[i], PATH_MAX);
tstrncpy(configDir, argv[i], PATH_MAX);
} else {
printf("'-c' requires a parameter, default is %s\n", configDir);
return -1;
......@@ -109,22 +106,21 @@ int main(int argc, char const *argv[]) {
return 0;
}
if (dmnInitLog(dmn.configDir, dmn.envFile, dmn.apolloUrl) != 0) {
if (dmn.printVersion) {
dmnPrintVersion();
return 0;
}
if (dmnInitLog(configDir, dmn.envFile, dmn.apolloUrl) != 0) {
return -1;
}
SConfig *pCfg = dmnReadCfg(dmn.configDir, dmn.envFile, dmn.apolloUrl);
SConfig *pCfg = dmnReadCfg(configDir, dmn.envFile, dmn.apolloUrl);
if (pCfg == NULL) {
uInfo("Failed to start TDengine since read config error");
return -1;
}
if (dmn.printVersion) {
dmnPrintVersion(pCfg);
cfgCleanup(pCfg);
return 0;
}
if (dmn.dumpConfig) {
dmnDumpCfg(pCfg);
cfgCleanup(pCfg);
......
......@@ -16,91 +16,72 @@
#define _DEFAULT_SOURCE
#include "dmnInt.h"
static int32_t dmnInitDnodeCfg(SConfig *pConfig) {
if (cfgAddString(pConfig, "version", version) != 0) return -1;
if (cfgAddString(pConfig, "buildinfo", buildinfo) != 0) return -1;
if (cfgAddString(pConfig, "gitinfo", gitinfo) != 0) return -1;
if (cfgAddTimezone(pConfig, "timezone", "") != 0) return -1;
if (cfgAddLocale(pConfig, "locale", "") != 0) return -1;
if (cfgAddCharset(pConfig, "charset", "") != 0) return -1;
if (cfgAddInt32(pConfig, "numOfCores", 1, 1, 100000) != 0) return -1;
if (cfgAddInt32(pConfig, "numOfCommitThreads", 4, 1, 1000) != 0) return -1;
if (cfgAddBool(pConfig, "telemetryReporting", 0) != 0) return -1;
if (cfgAddBool(pConfig, "enableCoreFile", 0) != 0) return -1;
if (cfgAddInt32(pConfig, "supportVnodes", 256, 0, 65536) != 0) return -1;
if (cfgAddInt32(pConfig, "statusInterval", 1, 1, 30) != 0) return -1;
if (cfgAddFloat(pConfig, "numOfThreadsPerCore", 1, 0, 10) != 0) return -1;
if (cfgAddFloat(pConfig, "ratioOfQueryCores", 1, 0, 5) != 0) return -1;
if (cfgAddInt32(pConfig, "maxShellConns", 50000, 10, 50000000) != 0) return -1;
if (cfgAddInt32(pConfig, "shellActivityTimer", 3, 1, 120) != 0) return -1;
if (cfgAddInt32(pConfig, "serverPort", 6030, 1, 65056) != 0) return -1;
static int32_t dmnAddDnodeCfg(SConfig *pCfg) {
if (cfgAddString(pCfg, "buildinfo", buildinfo) != 0) return -1;
if (cfgAddString(pCfg, "gitinfo", gitinfo) != 0) return -1;
if (cfgAddString(pCfg, "version", version) != 0) return -1;
if (cfgAddString(pCfg, "firstEp", "") != 0) return -1;
if (cfgAddString(pCfg, "secondEp", "") != 0) return -1;
if (cfgAddString(pCfg, "fqdn", "") != 0) return -1;
if (cfgAddInt32(pCfg, "serverPort", 6030, 1, 65056) != 0) return -1;
if (cfgAddDir(pCfg, "dataDir", tsDataDir) != 0) return -1;
if (cfgAddTimezone(pCfg, "timezone", "") != 0) return -1;
if (cfgAddLocale(pCfg, "locale", "") != 0) return -1;
if (cfgAddCharset(pCfg, "charset", "") != 0) return -1;
if (cfgAddInt32(pCfg, "numOfCores", 1, 1, 100000) != 0) return -1;
if (cfgAddInt32(pCfg, "numOfCommitThreads", 4, 1, 1000) != 0) return -1;
if (cfgAddBool(pCfg, "telemetryReporting", 0) != 0) return -1;
if (cfgAddBool(pCfg, "enableCoreFile", 0) != 0) return -1;
if (cfgAddInt32(pCfg, "supportVnodes", 256, 0, 65536) != 0) return -1;
if (cfgAddInt32(pCfg, "statusInterval", 1, 1, 30) != 0) return -1;
if (cfgAddFloat(pCfg, "numOfThreadsPerCore", 1, 0, 10) != 0) return -1;
if (cfgAddFloat(pCfg, "ratioOfQueryCores", 1, 0, 5) != 0) return -1;
if (cfgAddInt32(pCfg, "maxShellConns", 50000, 10, 50000000) != 0) return -1;
if (cfgAddInt32(pCfg, "shellActivityTimer", 3, 1, 120) != 0) return -1;
return 0;
}
int32_t dmnLoadCfg(SConfig *pConfig, const char *inputCfgDir, const char *envFile, const char *apolloUrl) {
char configDir[PATH_MAX] = {0};
char configFile[PATH_MAX + 100] = {0};
taosExpandDir(inputCfgDir, configDir, PATH_MAX);
snprintf(configFile, sizeof(configFile), "%s" TD_DIRSEP "taos.cfg", configDir);
if (cfgLoad(pConfig, CFG_STYPE_APOLLO_URL, apolloUrl) != 0) {
uError("failed to load from apollo url:%s since %s\n", apolloUrl, terrstr());
return -1;
}
if (cfgLoad(pConfig, CFG_STYPE_CFG_FILE, configFile) != 0) {
if (cfgLoad(pConfig, CFG_STYPE_CFG_FILE, configDir) != 0) {
uError("failed to load from config file:%s since %s\n", configFile, terrstr());
return -1;
}
}
int32_t dmnCheckCfg(SConfig *pCfg) {
bool enableCore = cfgGetItem(pCfg, "enableCoreFile")->bval;
taosSetCoreDump(enableCore);
if (cfgLoad(pConfig, CFG_STYPE_ENV_FILE, envFile) != 0) {
uError("failed to load from env file:%s since %s\n", envFile, terrstr());
return -1;
}
if (cfgLoad(pConfig, CFG_STYPE_ENV_VAR, NULL) != 0) {
uError("failed to load from global env variables since %s\n", terrstr());
return -1;
}
return 0;
}
SConfig *dmnReadCfg(const char *cfgDir, const char *envFile, const char *apolloUrl) {
SConfig *pConfig = cfgInit();
if (pConfig == NULL) return NULL;
SConfig *pCfg = cfgInit();
if (pCfg == NULL) return NULL;
if (dmnInitLogCfg(pConfig) != 0) {
uError("failed to init log cfg since %s", terrstr());
cfgCleanup(pConfig);
if (dmnAddLogCfg(pCfg) != 0) {
printf("failed to add log cfg since %s\n", terrstr());
cfgCleanup(pCfg);
return NULL;
}
if (dmnInitDnodeCfg(pConfig) != 0) {
if (dmnAddDnodeCfg(pCfg) != 0) {
uError("failed to init dnode cfg since %s", terrstr());
cfgCleanup(pConfig);
cfgCleanup(pCfg);
return NULL;
}
if (dmnLoadCfg(pConfig, cfgDir, envFile, apolloUrl) != 0) {
if (dmnLoadCfg(pCfg, cfgDir, envFile, apolloUrl) != 0) {
uError("failed to load cfg since %s", terrstr());
cfgCleanup(pConfig);
cfgCleanup(pCfg);
return NULL;
}
bool enableCore = cfgGetItem(pConfig, "enableCoreFile")->bval;
taosSetCoreDump(enableCore);
if (dmnCheckCfg(pCfg) != 0) {
uError("failed to check cfg since %s", terrstr());
}
if (taosCheckAndPrintCfg() != 0) {
uError("failed to check config");
return NULL;
}
return pConfig;
return pCfg;
}
void dmnDumpCfg(SConfig *pCfg) {
......@@ -146,7 +127,7 @@ SDnodeEnvCfg dmnGetEnvCfg(SConfig *pCfg) {
tstrncpy(envCfg.locale, cfgGetItem(pCfg, "locale")->str, sizeof(envCfg.locale));
tstrncpy(envCfg.charset, cfgGetItem(pCfg, "charset")->str, sizeof(envCfg.charset));
envCfg.numOfCores = cfgGetItem(pCfg, "numOfCores")->i32;
envCfg.numOfCommitThreads = (uint16_t) cfgGetItem(pCfg, "numOfCommitThreads")->i32;
envCfg.numOfCommitThreads = (uint16_t)cfgGetItem(pCfg, "numOfCommitThreads")->i32;
envCfg.enableTelem = cfgGetItem(pCfg, "telemetryReporting")->bval;
return envCfg;
......
......@@ -16,25 +16,52 @@
#define _DEFAULT_SOURCE
#include "dmnInt.h"
int32_t dmnInitLogCfg(SConfig *pCfg) {
int32_t dmnAddLogCfg(SConfig *pCfg) {
if (cfgAddDir(pCfg, "logDir", "/var/log/taos") != 0) return -1;
if (cfgAddBool(pCfg, "asyncLog", 1) != 0) return -1;
if (cfgAddInt32(pCfg, "numOfLogLines", 10000000, 1000, 2000000000) != 0) return -1;
if (cfgAddInt32(pCfg, "logKeepDays", 0, -365000, 365000) != 0) return -1;
if (cfgAddBool(pCfg, "asyncLog", 1) != 0) return -1;
if (cfgAddInt32(pCfg, "debugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "mDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "dDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "sDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "wDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "rpcDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "tmrDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "vDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "mDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "cDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "jniDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "tmrDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "uDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "rpcDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "qDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "vDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "wDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "sDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "tsdbDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "cqDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "tqDebugFlag", 0, 0, 255) != 0) return -1;
if (cfgAddInt32(pCfg, "fsDebugFlag", 0, 0, 255) != 0) return -1;
return 0;
}
int32_t dmnSetLogCfg(SConfig *pCfg) {
tstrncpy(tsLogDir, cfgGetItem(pCfg, "logDir")->str, PATH_MAX);
tsAsyncLog = cfgGetItem(pCfg, "asyncLog")->bval;
tsNumOfLogLines = cfgGetItem(pCfg, "numOfLogLines")->i32;
tsLogKeepDays = cfgGetItem(pCfg, "logKeepDays")->i32;
dDebugFlag = cfgGetItem(pCfg, "dDebugFlag")->i32;
vDebugFlag = cfgGetItem(pCfg, "vDebugFlag")->i32;
mDebugFlag = cfgGetItem(pCfg, "mDebugFlag")->i32;
cDebugFlag = cfgGetItem(pCfg, "cDebugFlag")->i32;
jniDebugFlag = cfgGetItem(pCfg, "jniDebugFlag")->i32;
tmrDebugFlag = cfgGetItem(pCfg, "tmrDebugFlag")->i32;
uDebugFlag = cfgGetItem(pCfg, "uDebugFlag")->i32;
rpcDebugFlag = cfgGetItem(pCfg, "rpcDebugFlag")->i32;
qDebugFlag = cfgGetItem(pCfg, "qDebugFlag")->i32;
wDebugFlag = cfgGetItem(pCfg, "wDebugFlag")->i32;
sDebugFlag = cfgGetItem(pCfg, "sDebugFlag")->i32;
tsdbDebugFlag = cfgGetItem(pCfg, "tsdbDebugFlag")->i32;
tqDebugFlag = cfgGetItem(pCfg, "tqDebugFlag")->i32;
fsDebugFlag = cfgGetItem(pCfg, "fsDebugFlag")->i32;
int32_t debugFlag = cfgGetItem(pCfg, "debugFlag")->i32;
taosSetAllDebugFlag(debugFlag);
return 0;
}
......@@ -42,26 +69,62 @@ int32_t dmnInitLog(const char *cfgDir, const char *envFile, const char *apolloUr
SConfig *pCfg = cfgInit();
if (pCfg == NULL) return -1;
if (dmnInitLogCfg(pCfg) != 0) {
uError("failed to init log cfg since %s\n", terrstr());
if (dmnAddLogCfg(pCfg) != 0) {
printf("failed to add log cfg since %s\n", terrstr());
cfgCleanup(pCfg);
return -1;
}
if (dmnLoadCfg(pCfg, cfgDir, envFile, apolloUrl) != 0) {
uError("failed to load log cfg since %s\n", terrstr());
printf("failed to load log cfg since %s\n", terrstr());
cfgCleanup(pCfg);
return -1;
}
char temp[PATH_MAX] = {0};
snprintf(temp, PATH_MAX, "%s" TD_DIRSEP "taosdlog", cfgGetItem(pCfg, "logDir")->str);
if (taosInitLog(temp, cfgGetItem(pCfg, "numOfLogLines")->i32, 1) != 0) {
uError("failed to init log file since %s\n", terrstr());
if (dmnSetLogCfg(pCfg) != 0) {
printf("failed to set log cfg since %s\n", terrstr());
cfgCleanup(pCfg);
return -1;
}
if (taosInitLog("taosdlog", 1) != 0) {
printf("failed to init log file since %s\n", terrstr());
cfgCleanup(pCfg);
return -1;
}
cfgCleanup(pCfg);
return 0;
}
int32_t dmnLoadCfg(SConfig *pConfig, const char *inputCfgDir, const char *envFile, const char *apolloUrl) {
char configDir[PATH_MAX] = {0};
char configFile[PATH_MAX + 100] = {0};
taosExpandDir(inputCfgDir, configDir, PATH_MAX);
snprintf(configFile, sizeof(configFile), "%s" TD_DIRSEP "taos.cfg", configDir);
if (cfgLoad(pConfig, CFG_STYPE_APOLLO_URL, apolloUrl) != 0) {
uError("failed to load from apollo url:%s since %s\n", apolloUrl, terrstr());
return -1;
}
if (cfgLoad(pConfig, CFG_STYPE_CFG_FILE, configFile) != 0) {
if (cfgLoad(pConfig, CFG_STYPE_CFG_FILE, configDir) != 0) {
uError("failed to load from config file:%s since %s\n", configFile, terrstr());
return -1;
}
}
if (cfgLoad(pConfig, CFG_STYPE_ENV_FILE, envFile) != 0) {
uError("failed to load from env file:%s since %s\n", envFile, terrstr());
return -1;
}
if (cfgLoad(pConfig, CFG_STYPE_ENV_VAR, NULL) != 0) {
uError("failed to load from global env variables since %s\n", terrstr());
return -1;
}
return 0;
}
......@@ -22,7 +22,7 @@ void dmnGenerateGrant() {
#endif
}
void dmnPrintVersion(SConfig *pCfg) {
void dmnPrintVersion() {
#ifdef TD_ENTERPRISE
char *releaseName = "enterprise";
#else
......
......@@ -28,16 +28,12 @@ void Testbase::InitLog(const char* path) {
wDebugFlag = 0;
sDebugFlag = 0;
tsdbDebugFlag = 0;
cqDebugFlag = 0;
tscEmbeddedInUtil = 1;
tsAsyncLog = 0;
taosRemoveDir(path);
taosMkDir(path);
char temp[PATH_MAX];
snprintf(temp, PATH_MAX, "%s/taosdlog", path);
if (taosInitLog(temp, tsNumOfLogLines, 1) != 0) {
if (taosInitLog("taosdlog", 1) != 0) {
printf("failed to init log file\n");
}
}
......
......@@ -131,9 +131,7 @@ void ctgTestInitLogFile() {
ctgDbgEnableDebug("api");
char temp[128] = {0};
sprintf(temp, "%s/%s", tsLogDir, defaultLogFileNamePrefix);
if (taosInitLog(temp, tsNumOfLogLines, maxLogFileNum) < 0) {
if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) {
printf("failed to open log file in directory:%s\n", tsLogDir);
}
}
......
......@@ -538,10 +538,7 @@ void cfgPrintCfg(SConfig *pCfg) {
}
int32_t cfgCheck(SConfig *pConfig) {
SConfigItem *pItem = cfgGetItem(pConfig, "debugFlag");
if (pItem != NULL) {
taosSetDebugFlag(pItem->i32);
}
SConfigItem *pItem = NULL;
pItem = cfgGetItem(pConfig, "localFqdn");
if (pItem != NULL) {
......
......@@ -101,9 +101,7 @@ void qwtInitLogFile() {
tsAsyncLog = 0;
qDebugFlag = 159;
char temp[128] = {0};
sprintf(temp, "%s/%s", tsLogDir, defaultLogFileNamePrefix);
if (taosInitLog(temp, tsNumOfLogLines, maxLogFileNum) < 0) {
if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) {
printf("failed to open log file in directory:%s\n", tsLogDir);
}
......
......@@ -66,9 +66,7 @@ void schtInitLogFile() {
tsAsyncLog = 0;
qDebugFlag = 159;
char temp[128] = {0};
sprintf(temp, "%s/%s", tsLogDir, defaultLogFileNamePrefix);
if (taosInitLog(temp, tsNumOfLogLines, maxLogFileNum) < 0) {
if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) {
printf("failed to open log file in directory:%s\n", tsLogDir);
}
......
......@@ -192,7 +192,7 @@ int main(int argc, char *argv[]) {
}
}
taosInitLog("client.log", 100000, 10);
taosInitLog("client.log", 10);
void *pRpc = rpcOpen(&rpcInit);
if (pRpc == NULL) {
......
......@@ -169,7 +169,7 @@ int main(int argc, char *argv[]) {
tsAsyncLog = 0;
rpcInit.connType = TAOS_CONN_SERVER;
taosInitLog("server.log", 100000, 10);
taosInitLog("server.log", 10);
void *pRpc = rpcOpen(&rpcInit);
if (pRpc == NULL) {
......
......@@ -169,7 +169,7 @@ int main(int argc, char *argv[]) {
}
}
taosInitLog("client.log", 100000, 10);
taosInitLog("client.log", 10);
void *pRpc = rpcOpen(&rpcInit);
if (pRpc == NULL) {
......
......@@ -148,7 +148,7 @@ int main(int argc, char *argv[]) {
}
}
taosInitLog("client.log", 100000, 10);
taosInitLog("client.log", 10);
void *pRpc = rpcOpen(&rpcInit);
if (pRpc == NULL) {
......
......@@ -158,7 +158,7 @@ int main(int argc, char *argv[]) {
tsAsyncLog = 0;
rpcInit.connType = TAOS_CONN_SERVER;
taosInitLog("server.log", 100000, 10);
taosInitLog("server.log", 10);
void *pRpc = rpcOpen(&rpcInit);
if (pRpc == NULL) {
......
......@@ -170,7 +170,7 @@ int main(int argc, char *argv[]) {
}
}
taosInitLog("client.log", 100000, 10);
taosInitLog("client.log", 10);
void *pRpc = rpcOpen(&rpcInit);
if (pRpc == NULL) {
......
......@@ -70,7 +70,7 @@ typedef struct {
int8_t tscEmbeddedInUtil = 0;
int32_t tsLogKeepDays = 0;
int8_t tsAsyncLog = 1;
bool tsAsyncLog = true;
float tsTotalLogDirGB = 0;
float tsAvailLogDirGB = 0;
float tsMinimalLogDirGB = 1.0f;
......@@ -79,20 +79,19 @@ int32_t writeInterval = DEFAULT_LOG_INTERVAL;
// log
int32_t tsNumOfLogLines = 10000000;
int32_t mDebugFlag = 131;
int32_t dDebugFlag = 135;
int32_t vDebugFlag = 135;
int32_t mDebugFlag = 131;
int32_t cDebugFlag = 131;
int32_t jniDebugFlag = 131;
int32_t qDebugFlag = 131;
int32_t rpcDebugFlag = 131;
int32_t tmrDebugFlag = 131;
int32_t uDebugFlag = 131;
int32_t debugFlag = 0;
int32_t sDebugFlag = 135;
int32_t rpcDebugFlag = 131;
int32_t qDebugFlag = 131;
int32_t wDebugFlag = 135;
int32_t sDebugFlag = 135;
int32_t tsdbDebugFlag = 131;
int32_t tqDebugFlag = 135;
int32_t cqDebugFlag = 131;
int32_t fsDebugFlag = 135;
int64_t dbgEmptyW = 0;
......@@ -120,10 +119,13 @@ static int32_t taosStartLog() {
return 0;
}
int32_t taosInitLog(char *logName, int numOfLogLines, int maxFiles) {
int32_t taosInitLog(const char *logName, int maxFiles) {
char fullName[PATH_MAX] = {0};
snprintf(fullName, PATH_MAX, "%s" TD_DIRSEP "%s", tsLogDir, logName);
tsLogObj.logHandle = taosLogBuffNew(TSDB_DEFAULT_LOG_BUF_SIZE);
if (tsLogObj.logHandle == NULL) return -1;
if (taosOpenLogFile(logName, numOfLogLines, maxFiles) < 0) return -1;
if (taosOpenLogFile(fullName, tsNumOfLogLines, maxFiles) < 0) return -1;
if (taosStartLog() < 0) return -1;
return 0;
}
......@@ -774,11 +776,22 @@ void taosPrintOsInfo() {
uInfo(" os machine: %s", info.machine);
}
void taosSetDebugFlag(int32_t flag) {
if (!(debugFlag & DEBUG_TRACE || debugFlag & DEBUG_DEBUG || debugFlag & DEBUG_DUMP)) return;
void taosSetAllDebugFlag(int32_t flag) {
if (!(flag & DEBUG_TRACE || flag & DEBUG_DEBUG || flag & DEBUG_DUMP)) return;
debugFlag = flag;
mDebugFlag = flag;
dDebugFlag = flag;
vDebugFlag = flag;
mDebugFlag = flag;
cDebugFlag = flag;
jniDebugFlag = flag;
uDebugFlag = flag;
rpcDebugFlag = flag;
qDebugFlag = flag;
wDebugFlag = flag;
sDebugFlag = flag;
tsdbDebugFlag = flag;
tqDebugFlag = flag;
fsDebugFlag = flag;
uInfo("all debug flag are set to %d", flag);
}
\ No newline at end of file
......@@ -81,7 +81,6 @@ typedef struct time_wheel_t {
tmr_obj_t** slots;
} time_wheel_t;
int32_t tmrDebugFlag = 131;
uint32_t tsMaxTmrCtrl = 512;
static pthread_once_t tmrModuleInit = PTHREAD_ONCE_INIT;
......
......@@ -158,7 +158,7 @@ int main(int argc, char *argv[]) {
}
}
taosInitLog("tref.log", 5000000, 10);
taosInitLog("tref.log", 10);
SRefSpace *pSpaceList = (SRefSpace *) calloc(sizeof(SRefSpace), threads);
pthread_t *pThreadList = (pthread_t *) calloc(sizeof(pthread_t), threads);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册