enh: print err msg only in embedded log mode

This commit is contained in:
kailixu 2025-02-08 16:08:40 +08:00
parent fea6148c96
commit f9dc305e35
1 changed files with 3 additions and 2 deletions

View File

@ -398,8 +398,9 @@ static void taosKeepOldLog(char *oldName) {
TAOS_UNUSED(taosUnLockFile(oldFile)); TAOS_UNUSED(taosUnLockFile(oldFile));
_exit2: _exit2:
TAOS_UNUSED(taosCloseFile(&oldFile)); TAOS_UNUSED(taosCloseFile(&oldFile));
if (code != 0) { if (code != 0 && tsLogEmbedded == 1) { // only print error message in embedded log mode
uWarn("failed at line %d to keep old log file:%s, reason:%s\n", lino, oldName, tstrerror(code)); // don't use uWarn or uError, because it may open new log file and cause dead lock
fprintf(stderr, "failed at line %d to keep old log file:%s, reason:%s\n", lino, oldName, tstrerror(code));
} }
} }
} }