diff --git a/modules/sandbox/sandbox_utils.cpp b/modules/sandbox/sandbox_utils.cpp index 1a89e6b0cda84809eb943b3ccea309780002c544..fccbb286348d700915bc89201599744a3ce159f8 100644 --- a/modules/sandbox/sandbox_utils.cpp +++ b/modules/sandbox/sandbox_utils.cpp @@ -1618,7 +1618,7 @@ int32_t SandboxUtils::SetSandboxProperty(AppSpawningCtx *appProperty, std::strin ret = SetBundleResourceAppSandboxProperty(appProperty, sandboxPackagePath); APPSPAWN_CHECK(ret == 0, return ret, "SetBundleResourceAppSandboxProperty failed, packagename is %{public}s", bundleName.c_str()); - APPSPAWN_LOGI("Set appsandbox property success"); + APPSPAWN_LOGV("Set appsandbox property success"); return ret; } @@ -1757,7 +1757,7 @@ int32_t SandboxUtils::SetAppSandboxProperty(AppSpawningCtx *appProperty, uint32_ #ifndef APPSPAWN_TEST rc = ChangeCurrentDir(sandboxPackagePath, bundleName, sandboxSharedStatus); APPSPAWN_CHECK(rc == 0, return rc, "change current dir failed"); - APPSPAWN_LOGI("Change root dir success"); + APPSPAWN_LOGV("Change root dir success"); #if defined(APPSPAWN_MOUNT_TMPSHM) && defined(WITH_SELINUX) Restorecon(DEV_SHM_DIR); #endif // APPSPAWN_MOUNT_TMPSHM && WITH_SELINUX diff --git a/standard/appspawn_kickdog.c b/standard/appspawn_kickdog.c index 7223bab449654619ef8a8d67e51b681f7c326bbd..8d2707498303b22a4544a88c3c30b23119d5deb8 100644 --- a/standard/appspawn_kickdog.c +++ b/standard/appspawn_kickdog.c @@ -34,7 +34,7 @@ static int OpenAndWriteToProc(const char *procName, const char *writeStr, size_t if (writeResult != (int)writeLen) { APPSPAWN_LOGE("write %{public}s fail,result:%{public}d", writeStr, writeResult); } else { - APPSPAWN_LOGI("write %{public}s success", writeStr); + APPSPAWN_LOGV("write %{public}s success", writeStr); } close(procFd); @@ -73,8 +73,9 @@ static void DealSpawnWatchdog(AppSpawnContent *content, bool isOpen) if (isOpen) { content->wdgOpened = (result != -1); } - APPSPAWN_LOGI("%{public}s %{public}s watchdog end, result:%{public}d", - (content->mode == MODE_FOR_NWEB_SPAWN) ? "Nwebspawn" : "Appspawn", isOpen ? "enable" : "kick", result); + APPSPAWN_LOGI("procFile: %{public}s procContent: %{public}s %{public}s %{public}s watchdog end, result:%{public}d", + procFile, procContent, (content->mode == MODE_FOR_NWEB_SPAWN) ? + "Nwebspawn" : "Appspawn", isOpen ? "enable" : "kick", result); } static void ProcessTimerHandle(const TimerHandle taskHandle, void *context) diff --git a/standard/appspawn_msgmgr.c b/standard/appspawn_msgmgr.c index b7b7b9035852a720174b17f0e6f0f4aac2da393c..1eec1f5b7f0151251cf392357d1020de5261599a 100644 --- a/standard/appspawn_msgmgr.c +++ b/standard/appspawn_msgmgr.c @@ -345,10 +345,11 @@ int GetAppSpawnMsgFromBuffer(const uint8_t *buffer, uint32_t bufferLen, return 0; } -static inline void DumpMsgFlags(const char *info, const AppSpawnMsgFlags *msgFlags) +static inline void DumpMsgFlags(const char *processName, const char *info, const AppSpawnMsgFlags *msgFlags) { for (uint32_t i = 0; i < msgFlags->count; i++) { - APPSPAWN_DUMP("%{public}s flags: 0x%{public}x", info, msgFlags->flags[i]); + APPSPAWN_DUMP("processName: %{public}s %{public}d %{public}s flags: 0x%{public}x", + processName, i, info, msgFlags->flags[i]); } } @@ -360,7 +361,7 @@ static inline void DumpMsgExtInfo(const AppSpawnTlv *tlv) } AppSpawnTlvExt *tlvExt = (AppSpawnTlvExt *)(tlv); if (tlvExt->dataType == DATA_TYPE_STRING) { - APPSPAWN_DUMP("App extend info name: %{public}s len: %{public}u value: '%{public}s'", + APPSPAWN_DEBUG_DUMP("App extend info name: %{public}s len: %{public}u value: '%{public}s'", tlvExt->tlvName, tlvExt->dataLen, (char *)(tlvExt + 1)); } else { APPSPAWN_DUMP("App extend info name: %{public}s len: %{public}u", tlvExt->tlvName, tlvExt->dataLen); @@ -374,9 +375,10 @@ void DumpAppSpawnMsg(const AppSpawnMsgNode *message) message->msgHeader.msgId, message->msgHeader.msgLen, message->tlvCount, message->msgHeader.processName); AppSpawnMsgFlags *msgFlags = (AppSpawnMsgFlags *)GetAppSpawnMsgInfo(message, TLV_MSG_FLAGS); - APPSPAWN_ONLY_EXPER(msgFlags != NULL, DumpMsgFlags("App flags", msgFlags)); + APPSPAWN_ONLY_EXPER(msgFlags != NULL, DumpMsgFlags(message->msgHeader.processName, "App flags", msgFlags)); msgFlags = (AppSpawnMsgFlags *)GetAppSpawnMsgInfo(message, TLV_PERMISSION); - APPSPAWN_ONLY_EXPER(msgFlags != NULL, DumpMsgFlags("App permission bits", msgFlags)); + APPSPAWN_ONLY_EXPER(msgFlags != NULL, + DumpMsgFlags(message->msgHeader.processName, "App permission bits", msgFlags)); AppSpawnMsgDacInfo *dacInfo = (AppSpawnMsgDacInfo *)GetAppSpawnMsgInfo(message, TLV_DAC_INFO); if (dacInfo != NULL) { @@ -401,11 +403,11 @@ void DumpAppSpawnMsg(const AppSpawnMsgNode *message) } AppSpawnMsgOwnerId *owner = (AppSpawnMsgOwnerId *)GetAppSpawnMsgInfo(message, TLV_OWNER_INFO); - APPSPAWN_ONLY_EXPER(owner != NULL, APPSPAWN_DUMP("App owner info: \"%{public}s\" ", owner->ownerId)); + APPSPAWN_ONLY_EXPER(owner != NULL, APPSPAWN_DEBUG_DUMP("App owner info: \"%{public}s\" ", owner->ownerId)); AppSpawnMsgInternetInfo *info = (AppSpawnMsgInternetInfo *)GetAppSpawnMsgInfo(message, TLV_INTERNET_INFO); APPSPAWN_ONLY_EXPER(info != NULL, - APPSPAWN_DUMP("App internet permission info [%{public}d %{public}d]", + APPSPAWN_DEBUG_DUMP("App internet permission info [%{public}d %{public}d]", info->setAllowInternet, info->allowInternet)); for (uint32_t i = TLV_MAX; i < TLV_MAX + message->tlvCount; i++) { diff --git a/standard/appspawn_service.c b/standard/appspawn_service.c index 954e9bc709707cb914640ba8d8a67cea13f7f1aa..1764d93c5eef9cb6a16f8e16224524401cf8a8d9 100644 --- a/standard/appspawn_service.c +++ b/standard/appspawn_service.c @@ -772,7 +772,7 @@ static void ProcessPreFork(AppSpawnContent *content, AppSpawningCtx *property) (void)close(property->forkCtx.fd[0]); (void)close(property->forkCtx.fd[1]); int isRet = SetPreforkProcessName(content); - APPSPAWN_LOGI("prefork process start wait read msg with set processname %{public}d", isRet); + APPSPAWN_LOGV("prefork process start wait read msg with set processname %{public}d", isRet); AppSpawnClient client = {0, 0}; int infoSize = read(content->parentToChildFd[0], &client, sizeof(AppSpawnClient)); if (infoSize != sizeof(AppSpawnClient)) { @@ -897,7 +897,7 @@ static void ProcessSpawnReqMsg(AppSpawnConnection *connection, AppSpawnMsgNode * if (IsSupportRunHnp()) { SetAppSpawnMsgFlag(message, TLV_MSG_FLAGS, APP_FLAGS_DEVELOPER_MODE); } else { - APPSPAWN_LOGI("Not support execute hnp file!"); + APPSPAWN_LOGV("Not support execute hnp file!"); } } diff --git a/util/include/appspawn_utils.h b/util/include/appspawn_utils.h index ff220c3335109b87251a7b33a4936c6d64dfd911..e22135cf2c6845c0cfc9eb9ad12bf1834e157030 100755 --- a/util/include/appspawn_utils.h +++ b/util/include/appspawn_utils.h @@ -182,6 +182,12 @@ int EnableNewNetNamespace(void); AppSpawnDump(fmt "\n", ##__VA_ARGS__); \ } while (0) +#define APPSPAWN_DEBUG_DUMP(fmt, ...) \ + do { \ + HILOG_DEBUG(LOG_CORE, fmt, ##__VA_ARGS__); \ + AppSpawnDump(fmt "\n", ##__VA_ARGS__); \ + } while (0) + #else #define APPSPAWN_LOGI(fmt, ...) \