From 3908022daeba5bf64fb036e9aaec0b4202e7a5a6 Mon Sep 17 00:00:00 2001 From: yaomanhai Date: Thu, 24 Mar 2022 09:51:21 +0800 Subject: [PATCH 1/8] Support config hilogd buffer size by setting sysparam Signed-off-by: yaomanhai --- adapter/properties.cpp | 41 +++++++++++++++++++++++- adapter/properties.h | 4 ++- frameworks/native/include/hilog_common.h | 3 +- services/hilogd/etc/hilog.para | 1 + services/hilogd/etc/hilogd.cfg | 1 + services/hilogd/include/log_buffer.h | 2 ++ services/hilogd/log_buffer.cpp | 24 +++++++++++--- services/hilogd/main.cpp | 3 ++ services/hilogtool/log_controller.cpp | 14 ++++---- 9 files changed, 79 insertions(+), 14 deletions(-) mode change 100755 => 100644 services/hilogd/etc/hilog.para diff --git a/adapter/properties.cpp b/adapter/properties.cpp index aa62ef4..ad0efa5 100644 --- a/adapter/properties.cpp +++ b/adapter/properties.cpp @@ -189,7 +189,7 @@ void PropertySet(const string &key, const char* value) { auto len = value ? strlen(value) : 0; if (len > HILOG_PROP_VALUE_MAX) { - std::cerr << "PropertyGet(): len exceed maximum.\n"; + std::cerr << "PropertySet(): len exceed maximum.\n"; return; } @@ -243,6 +243,8 @@ string GetPropertyName(uint32_t propType) case PROP_PERSIST_DEBUG: key = "persist.sys.hilog.debug.on"; break; + case PROP_BUFFER_SIZE: + key = "hilog.buffersize."; default: break; } @@ -435,3 +437,40 @@ uint16_t GetTagLevel(const string& tag) LogLevelCache* levelCache = it->second; return levelCache->getValue(); } + +static string GetBufferSizePropStr(LogType type, bool persist) +{ + string name; + + static const string logTypeStr[LOG_TYPE_MAX] = { + "app", "init", "", "core", "kmsg", "global" + }; + name = persist ? "persist." : "" + GetPropertyName(PROP_BUFFER_SIZE) + logTypeStr[type]; + return name; +} + +size_t GetBufferSize(LogType type, bool persist) +{ + char value[HILOG_PROP_VALUE_MAX] = {0}; + + if (type > LOG_TYPE_MAX || type < LOG_TYPE_MIN) { + return 0; + } + + PropertyGet(GetBufferSizePropStr(type, persist), value); + if (value[0] == 0) { + return 0; + } + + return std::stoi(value); +} + +void SetBufferSize(LogType type, bool persist, size_t size) +{ + if (type > LOG_TYPE_MAX || type < LOG_TYPE_MIN) { + return; + } + + PropertySet(GetBufferSizePropStr(type, persist), to_string(size)); + return; +} \ No newline at end of file diff --git a/adapter/properties.h b/adapter/properties.h index 12d2e5d..5142c9e 100644 --- a/adapter/properties.h +++ b/adapter/properties.h @@ -32,6 +32,7 @@ using PropType = enum { PROP_SINGLE_DEBUG, PROP_KMSG, PROP_PERSIST_DEBUG, + PROP_BUFFER_SIZE, }; std::string GetPropertyName(uint32_t propType); @@ -48,5 +49,6 @@ bool IsDomainSwitchOn(); bool IsKmsgSwitchOn(); uint16_t GetGlobalLevel(); uint16_t GetDomainLevel(uint32_t domain); - +size_t GetBufferSize(LogType type, bool persist); +void SetBufferSize(LogType type, bool persist, size_t size); #endif diff --git a/frameworks/native/include/hilog_common.h b/frameworks/native/include/hilog_common.h index 5b387bd..9b9158e 100644 --- a/frameworks/native/include/hilog_common.h +++ b/frameworks/native/include/hilog_common.h @@ -50,7 +50,8 @@ const long long NSEC = 1000000000LL; const long long US = 1000000LL; const long long NS2US = 1000LL; const long long NS2MS = 1000000LL; -const uint32_t MAX_BUFFER_SIZE = 1UL<<30; +const size_t MIN_BUFFER_SIZE = 65536; +const size_t MAX_BUFFER_SIZE = 1UL<<30; const uint32_t MAX_PERSISTER_BUFFER_SIZE = 64 * 1024; constexpr int MIN_LOG_FILE_NUM = 2; constexpr int MAX_LOG_FILE_NUM = 1000; diff --git a/services/hilogd/etc/hilog.para b/services/hilogd/etc/hilog.para old mode 100755 new mode 100644 index 6d55603..16301b2 --- a/services/hilogd/etc/hilog.para +++ b/services/hilogd/etc/hilog.para @@ -20,3 +20,4 @@ hilog.flowctrl.pid.on=false hilog.flowctrl.domain.on=false hilog.loggable.global=d +hilog.buffersize.global=262144 \ No newline at end of file diff --git a/services/hilogd/etc/hilogd.cfg b/services/hilogd/etc/hilogd.cfg index 0cd5bd3..64cdfba 100644 --- a/services/hilogd/etc/hilogd.cfg +++ b/services/hilogd/etc/hilogd.cfg @@ -9,6 +9,7 @@ "cmds" : [ "mkdir /data/log/ 0770 system log", "mkdir /data/log/hilog/ 0750 logd log" + "setparam hilog.buffersize.global 262144" ] } ], diff --git a/services/hilogd/include/log_buffer.h b/services/hilogd/include/log_buffer.h index 46919c1..02e7f23 100644 --- a/services/hilogd/include/log_buffer.h +++ b/services/hilogd/include/log_buffer.h @@ -44,6 +44,8 @@ public: void RemoveBufReader(const ReaderId& id); int32_t Delete(uint16_t logType); + + void InitBuffLen(); int64_t GetBuffLen(uint16_t logType); int32_t SetBuffLen(uint16_t logType, uint64_t buffSize); int32_t GetStatisticInfoByLog(uint16_t logType, uint64_t& printLen, uint64_t& cacheLen, int32_t& dropped); diff --git a/services/hilogd/log_buffer.cpp b/services/hilogd/log_buffer.cpp index 4b38c1f..b05c06d 100644 --- a/services/hilogd/log_buffer.cpp +++ b/services/hilogd/log_buffer.cpp @@ -20,12 +20,12 @@ #include "hilog_common.h" #include "flow_control_init.h" #include "log_time_stamp.h" +#include "properties.h" namespace OHOS { namespace HiviewDFX { using namespace std; -const float DROP_RATIO = 0.05; -static size_t g_maxBufferSize = 4194304; +static const float DROP_RATIO = 0.05; static size_t g_maxBufferSizeByType[LOG_TYPE_MAX] = {262144, 262144, 262144, 262144, 262144}; const int DOMAIN_STRICT_MASK = 0xd000000; const int DOMAIN_FUZZY_MASK = 0xdffff; @@ -40,6 +40,7 @@ HilogBuffer::HilogBuffer() printLenByType[i] = 0; droppedByType[i] = 0; } + InitBuffLen(); } HilogBuffer::~HilogBuffer() {} @@ -230,6 +231,20 @@ std::shared_ptr HilogBuffer::GetReader(const ReaderId return std::shared_ptr(); } +void InitBuffLen() +{ + size_t global_size = GetBufferSize(LOG_TYPE_MAX, false); + size_t persist_global_size = GetBufferSize(LOG_TYPE_MAX, true); + for (int i = 0; i < LOG_TYPE_MAX; i++) { + size_t size = GetBufferSize(i, false); + size_t persist_size = GetBufferSize(i, true); + SetBuffLen(i, global_size); + SetBuffLen(i, persist_global_size); + SetBuffLen(i, size); + SetBuffLen(i, persist_size); + } +} + int64_t HilogBuffer::GetBuffLen(uint16_t logType) { if (logType >= LOG_TYPE_MAX) { @@ -244,11 +259,12 @@ int32_t HilogBuffer::SetBuffLen(uint16_t logType, uint64_t buffSize) if (logType >= LOG_TYPE_MAX) { return ERR_LOG_TYPE_INVALID; } - if (buffSize <= 0 || buffSize > MAX_BUFFER_SIZE) { + if (buffSize < MIN_BUFFER_SIZE || buffSize > MAX_BUFFER_SIZE) { return ERR_BUFF_SIZE_INVALID; } + std::unique_lock lock(hilogBufferMutex); g_maxBufferSizeByType[logType] = buffSize; - g_maxBufferSize += (buffSize - sizeByType[logType]); + SetBufferSize(logType, true, buffSize); return buffSize; } diff --git a/services/hilogd/main.cpp b/services/hilogd/main.cpp index 3dc165f..cfdf8aa 100644 --- a/services/hilogd/main.cpp +++ b/services/hilogd/main.cpp @@ -185,10 +185,13 @@ int HilogdEntry() auto startupCheckTask = std::async(std::launch::async, [&hilogBuffer]() { prctl(PR_SET_NAME, "hilogd.pst_res"); if (WaitingToDo(WAITING_DATA_MS, HILOG_FILE_DIR, WaitingDataMounted) == 0) { + hilogBuffer.InitBuffLen(); RestorePersistJobs(hilogBuffer); } }); + auto kmsgTask = std::async(std::launch::async, [&hilogBuffer]() { + prctl(PR_SET_NAME, "hilogd.rd_kmsg"); LogKmsg logKmsg(hilogBuffer); logKmsg.ReadAllKmsg(); }); diff --git a/services/hilogtool/log_controller.cpp b/services/hilogtool/log_controller.cpp index 9addb78..b913f16 100644 --- a/services/hilogtool/log_controller.cpp +++ b/services/hilogtool/log_controller.cpp @@ -85,7 +85,7 @@ uint16_t GetLogType(const string& logTypeStr) } else if (logTypeStr == "kmsg") { logType = LOG_KMSG; } else { - return 0xffff; + logType = LOG_TYPE_MAX; } return logType; } @@ -272,7 +272,7 @@ int32_t BufferSizeOp(SeqPacketSocketClient& controller, uint8_t msgCmd, const st } for (iter = 0; iter < logTypeNum; iter++) { pBuffSizeMsg->logType = GetLogType(vecLogType[iter]); - if (pBuffSizeMsg->logType == 0xffff) { + if (pBuffSizeMsg->logType == LOG_TYPE_MAX) { cout << ParseErrorCode(ERR_LOG_TYPE_INVALID) << endl; return RET_FAIL; } @@ -291,7 +291,7 @@ int32_t BufferSizeOp(SeqPacketSocketClient& controller, uint8_t msgCmd, const st } for (iter = 0; iter < logTypeNum; iter++) { pBuffResizeMsg->logType = GetLogType(vecLogType[iter]); - if (pBuffResizeMsg->logType == 0xffff) { + if (pBuffResizeMsg->logType == LOG_TYPE_MAX) { cout << ParseErrorCode(ERR_LOG_TYPE_INVALID) << endl; return RET_FAIL; } @@ -319,7 +319,7 @@ int32_t StatisticInfoOp(SeqPacketSocketClient& controller, uint8_t msgCmd, uint32_t domain; if (domainStr == "") { domain = 0xffffffff; - if (logType == 0xffff) { + if (logType == LOG_TYPE_MAX) { cout << ParseErrorCode(ERR_LOG_TYPE_INVALID) << endl; return RET_FAIL; } @@ -374,7 +374,7 @@ int32_t LogClearOp(SeqPacketSocketClient& controller, uint8_t msgCmd, const std: } for (iter = 0; iter < logTypeNum; iter++) { pLogClearMsg->logType = GetLogType(vecLogType[iter]); - if (pLogClearMsg->logType == 0xffff) { + if (pLogClearMsg->logType == LOG_TYPE_MAX) { cout << ParseErrorCode(ERR_LOG_TYPE_INVALID) << endl; return RET_FAIL; } @@ -412,7 +412,7 @@ int32_t LogPersistOp(SeqPacketSocketClient& controller, uint8_t msgCmd, LogPersi } for (iter = 0; iter < logTypeNum; iter++) { uint16_t tmpType = GetLogType(vecLogType[iter]); - if (tmpType == 0xffff) { + if (tmpType == LOG_TYPE_MAX) { cout << ParseErrorCode(ERR_LOG_TYPE_INVALID) << endl; return RET_FAIL; } @@ -479,7 +479,7 @@ int32_t LogPersistOp(SeqPacketSocketClient& controller, uint8_t msgCmd, LogPersi for (iter = 0; iter < logTypeNum; iter++) { uint16_t tmpType = GetLogType(vecLogType[iter]); - if (tmpType == 0xffff) { + if (tmpType == LOG_TYPE_MAX) { cout << ParseErrorCode(ERR_LOG_TYPE_INVALID) << endl; return RET_FAIL; } -- Gitee From 76c958e478748e3733ba6cef349acfe76208d7b3 Mon Sep 17 00:00:00 2001 From: yaomanhai Date: Thu, 24 Mar 2022 10:04:30 +0800 Subject: [PATCH 2/8] Support config hilogd buffer size by setting sysparam Signed-off-by: yaomanhai --- services/hilogd/log_buffer.cpp | 1 - services/hilogtool/log_display.cpp | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/services/hilogd/log_buffer.cpp b/services/hilogd/log_buffer.cpp index b05c06d..eece11d 100644 --- a/services/hilogd/log_buffer.cpp +++ b/services/hilogd/log_buffer.cpp @@ -264,7 +264,6 @@ int32_t HilogBuffer::SetBuffLen(uint16_t logType, uint64_t buffSize) } std::unique_lock lock(hilogBufferMutex); g_maxBufferSizeByType[logType] = buffSize; - SetBufferSize(logType, true, buffSize); return buffSize; } diff --git a/services/hilogtool/log_display.cpp b/services/hilogtool/log_display.cpp index 4e0a76a..435b1be 100644 --- a/services/hilogtool/log_display.cpp +++ b/services/hilogtool/log_display.cpp @@ -23,6 +23,7 @@ #include "format.h" #include "log_controller.h" #include "log_display.h" +#include "properties.h" namespace OHOS { namespace HiviewDFX { @@ -224,6 +225,7 @@ int32_t ControlCmdResult(const char* message) outputStr += " buffer size is "; outputStr += GetByteLenStr(pBuffResizeRst->buffSize); outputStr += "\n"; + SetBufferSize((LogType)pBuffResizeRst->logType, true, (size_t)pBuffResizeRst->buffSize); } pBuffResizeRst++; resultLen += sizeof(BuffSizeResult); -- Gitee From 5af6b4581619a11d0e9e9092f07fa8b55284590a Mon Sep 17 00:00:00 2001 From: yaomanhai Date: Thu, 24 Mar 2022 10:31:06 +0800 Subject: [PATCH 3/8] Support config hilogd buffer size by setting sysparam Signed-off-by: yaomanhai --- adapter/properties.cpp | 16 ++++++++-------- adapter/properties.h | 4 ++-- services/hilogtool/log_display.cpp | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/adapter/properties.cpp b/adapter/properties.cpp index ad0efa5..950b21b 100644 --- a/adapter/properties.cpp +++ b/adapter/properties.cpp @@ -103,14 +103,14 @@ public: if (m_commit == 0) { // temparary solution, after sysparam supply get_global_commitid, FIXME return m_defaultValue; } - auto handle = FindParameter(m_key.c_str()); + int handle = (int)FindParameter(m_key.c_str()); if (handle == -1) { m_commit = 0; // temparary solution, after sysparam supply get_global_commitid, FIXME return m_defaultValue; } m_handle = handle; } - auto currentCommit = GetParameterCommitId(m_handle); + int currentCommit = (int)GetParameterCommitId(m_handle); PropertyTypeLocker locker(m_propType); if (locker.isLocked()) { if (currentCommit != m_commit) { @@ -153,8 +153,8 @@ private: } RawPropertyData m_rawData = {0}; - unsigned int m_handle = -1; - unsigned int m_commit = -1; + int m_handle = -1; + int m_commit = -1; T m_value; const T m_defaultValue; const uint32_t m_propType; @@ -173,7 +173,7 @@ void PropertyGet(const string &key, char *value, int len) return; } - auto handle = FindParameter(key.c_str()); + int handle = (int)FindParameter(key.c_str()); if (handle == -1) { return; } @@ -442,7 +442,7 @@ static string GetBufferSizePropStr(LogType type, bool persist) { string name; - static const string logTypeStr[LOG_TYPE_MAX] = { + static const string logTypeStr[LOG_TYPE_MAX + 1] = { "app", "init", "", "core", "kmsg", "global" }; name = persist ? "persist." : "" + GetPropertyName(PROP_BUFFER_SIZE) + logTypeStr[type]; @@ -457,7 +457,7 @@ size_t GetBufferSize(LogType type, bool persist) return 0; } - PropertyGet(GetBufferSizePropStr(type, persist), value); + PropertyGet(GetBufferSizePropStr(type, persist), value, HILOG_PROP_VALUE_MAX); if (value[0] == 0) { return 0; } @@ -471,6 +471,6 @@ void SetBufferSize(LogType type, bool persist, size_t size) return; } - PropertySet(GetBufferSizePropStr(type, persist), to_string(size)); + PropertySet(GetBufferSizePropStr(type, persist), to_string(size).c_str()); return; } \ No newline at end of file diff --git a/adapter/properties.h b/adapter/properties.h index 5142c9e..3c01da3 100644 --- a/adapter/properties.h +++ b/adapter/properties.h @@ -49,6 +49,6 @@ bool IsDomainSwitchOn(); bool IsKmsgSwitchOn(); uint16_t GetGlobalLevel(); uint16_t GetDomainLevel(uint32_t domain); -size_t GetBufferSize(LogType type, bool persist); -void SetBufferSize(LogType type, bool persist, size_t size); +size_t GetBufferSize(uint16_t type, bool persist); +void SetBufferSize(uint16_t type, bool persist, size_t size); #endif diff --git a/services/hilogtool/log_display.cpp b/services/hilogtool/log_display.cpp index 435b1be..bae3402 100644 --- a/services/hilogtool/log_display.cpp +++ b/services/hilogtool/log_display.cpp @@ -22,8 +22,8 @@ #include "hilog/log.h" #include "format.h" #include "log_controller.h" -#include "log_display.h" #include "properties.h" +#include "log_display.h" namespace OHOS { namespace HiviewDFX { -- Gitee From 8ae63a93f441d5e49c9a5226ee92e038b4bbc4ea Mon Sep 17 00:00:00 2001 From: yaomanhai Date: Thu, 24 Mar 2022 11:10:02 +0800 Subject: [PATCH 4/8] Support config hilogd buffer size by setting sysparam Signed-off-by: yaomanhai --- adapter/properties.cpp | 10 +++++----- services/hilogd/log_buffer.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/adapter/properties.cpp b/adapter/properties.cpp index 950b21b..a4fc6c0 100644 --- a/adapter/properties.cpp +++ b/adapter/properties.cpp @@ -103,14 +103,14 @@ public: if (m_commit == 0) { // temparary solution, after sysparam supply get_global_commitid, FIXME return m_defaultValue; } - int handle = (int)FindParameter(m_key.c_str()); + int handle = static_cast(FindParameter(m_key.c_str())); if (handle == -1) { m_commit = 0; // temparary solution, after sysparam supply get_global_commitid, FIXME return m_defaultValue; } m_handle = handle; } - int currentCommit = (int)GetParameterCommitId(m_handle); + int currentCommit = static_cast(GetParameterCommitId(m_handle)); PropertyTypeLocker locker(m_propType); if (locker.isLocked()) { if (currentCommit != m_commit) { @@ -173,7 +173,7 @@ void PropertyGet(const string &key, char *value, int len) return; } - int handle = (int)FindParameter(key.c_str()); + int handle = static_cast(FindParameter(key.c_str()); if (handle == -1) { return; } @@ -449,7 +449,7 @@ static string GetBufferSizePropStr(LogType type, bool persist) return name; } -size_t GetBufferSize(LogType type, bool persist) +size_t GetBufferSize(uint16_t type, bool persist) { char value[HILOG_PROP_VALUE_MAX] = {0}; @@ -465,7 +465,7 @@ size_t GetBufferSize(LogType type, bool persist) return std::stoi(value); } -void SetBufferSize(LogType type, bool persist, size_t size) +void SetBufferSize(uint16_t type, bool persist, size_t size) { if (type > LOG_TYPE_MAX || type < LOG_TYPE_MIN) { return; diff --git a/services/hilogd/log_buffer.cpp b/services/hilogd/log_buffer.cpp index eece11d..337852e 100644 --- a/services/hilogd/log_buffer.cpp +++ b/services/hilogd/log_buffer.cpp @@ -231,7 +231,7 @@ std::shared_ptr HilogBuffer::GetReader(const ReaderId return std::shared_ptr(); } -void InitBuffLen() +void HilogBuffer::InitBuffLen() { size_t global_size = GetBufferSize(LOG_TYPE_MAX, false); size_t persist_global_size = GetBufferSize(LOG_TYPE_MAX, true); -- Gitee From 10d2372f7cb1bb1a79ac9dbe39e5c77429ab33a3 Mon Sep 17 00:00:00 2001 From: yaomanhai Date: Thu, 24 Mar 2022 11:38:12 +0800 Subject: [PATCH 5/8] Support config hilogd buffer size by setting sysparam Signed-off-by: yaomanhai --- adapter/properties.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/adapter/properties.cpp b/adapter/properties.cpp index a4fc6c0..e04a016 100644 --- a/adapter/properties.cpp +++ b/adapter/properties.cpp @@ -173,7 +173,7 @@ void PropertyGet(const string &key, char *value, int len) return; } - int handle = static_cast(FindParameter(key.c_str()); + int handle = static_cast(FindParameter(key.c_str())); if (handle == -1) { return; } @@ -438,7 +438,7 @@ uint16_t GetTagLevel(const string& tag) return levelCache->getValue(); } -static string GetBufferSizePropStr(LogType type, bool persist) +static string GetBufferSizePropName(uint16_t type, bool persist) { string name; @@ -457,7 +457,7 @@ size_t GetBufferSize(uint16_t type, bool persist) return 0; } - PropertyGet(GetBufferSizePropStr(type, persist), value, HILOG_PROP_VALUE_MAX); + PropertyGet(GetBufferSizePropName(type, persist), value, HILOG_PROP_VALUE_MAX); if (value[0] == 0) { return 0; } @@ -471,6 +471,6 @@ void SetBufferSize(uint16_t type, bool persist, size_t size) return; } - PropertySet(GetBufferSizePropStr(type, persist), to_string(size).c_str()); + PropertySet(GetBufferSizePropName(type, persist), to_string(size).c_str()); return; } \ No newline at end of file -- Gitee From d0e789beb67f4fd65d35381b7c64d92d956ec5b7 Mon Sep 17 00:00:00 2001 From: yaomanhai Date: Thu, 24 Mar 2022 17:42:13 +0800 Subject: [PATCH 6/8] Support config hilogd buffer size by setting sysparam Signed-off-by: yaomanhai --- adapter/properties.cpp | 2 +- services/hilogd/etc/hilogd.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/adapter/properties.cpp b/adapter/properties.cpp index e04a016..dfd79ec 100644 --- a/adapter/properties.cpp +++ b/adapter/properties.cpp @@ -445,7 +445,7 @@ static string GetBufferSizePropName(uint16_t type, bool persist) static const string logTypeStr[LOG_TYPE_MAX + 1] = { "app", "init", "", "core", "kmsg", "global" }; - name = persist ? "persist." : "" + GetPropertyName(PROP_BUFFER_SIZE) + logTypeStr[type]; + name = persist ? "persist.sys." : "" + GetPropertyName(PROP_BUFFER_SIZE) + logTypeStr[type]; return name; } diff --git a/services/hilogd/etc/hilogd.cfg b/services/hilogd/etc/hilogd.cfg index 64cdfba..032464a 100644 --- a/services/hilogd/etc/hilogd.cfg +++ b/services/hilogd/etc/hilogd.cfg @@ -8,7 +8,7 @@ "name" : "services:hilogd", "cmds" : [ "mkdir /data/log/ 0770 system log", - "mkdir /data/log/hilog/ 0750 logd log" + "mkdir /data/log/hilog/ 0750 logd log", "setparam hilog.buffersize.global 262144" ] } -- Gitee From f25208e1a8e7b2fa20ea746fa7bffd0f1b261b6b Mon Sep 17 00:00:00 2001 From: yaomanhai Date: Fri, 25 Mar 2022 09:00:50 +0800 Subject: [PATCH 7/8] Support config hilogd buffer size by setting sysparam Signed-off-by: yaomanhai --- adapter/properties.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapter/properties.cpp b/adapter/properties.cpp index dfd79ec..858e364 100644 --- a/adapter/properties.cpp +++ b/adapter/properties.cpp @@ -198,7 +198,7 @@ void PropertySet(const string &key, const char* value) if (result == EC_INVALID) { std::cerr << "PropertySet(): Invalid arguments.\n"; } else { - std::cerr << "PropertySet(): Error: " << result << "\n"; + std::cerr << "PropertySet(): key: " << key.c_str() << "value: " << value << "Error: " << result << "\n"; } } } -- Gitee From 61e2d826e2ccb11c767e15f34454c910538833a6 Mon Sep 17 00:00:00 2001 From: yaomanhai Date: Fri, 25 Mar 2022 11:40:52 +0800 Subject: [PATCH 8/8] Support that config hilogd buffer size by setting sysparam Signed-off-by: yaomanhai --- adapter/properties.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adapter/properties.cpp b/adapter/properties.cpp index 858e364..f810db3 100644 --- a/adapter/properties.cpp +++ b/adapter/properties.cpp @@ -440,12 +440,12 @@ uint16_t GetTagLevel(const string& tag) static string GetBufferSizePropName(uint16_t type, bool persist) { - string name; + string name = persist ? "persist.sys." : ""; static const string logTypeStr[LOG_TYPE_MAX + 1] = { "app", "init", "", "core", "kmsg", "global" }; - name = persist ? "persist.sys." : "" + GetPropertyName(PROP_BUFFER_SIZE) + logTypeStr[type]; + name += GetPropertyName(PROP_BUFFER_SIZE) + logTypeStr[type]; return name; } -- Gitee