summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluwenpeng <[email protected]>2024-08-14 14:27:38 +0800
committerluwenpeng <[email protected]>2024-08-14 17:25:46 +0800
commit5abf0d79423102008fed604c5f59e21e3f15ce0e (patch)
tree136e3e23516361d35cb5dd700477fb3e96571fed
parente8299dd77cfde9411a7f11c3bdaa0d7cb3af8c0e (diff)
enhance: when setting the log output file, stellar still outputs necessary log information to stderr
-rw-r--r--src/log/log.cpp6
-rw-r--r--src/packet_io/dumpfile_io.cpp2
-rw-r--r--src/stellar/stellar_core.cpp2
3 files changed, 8 insertions, 2 deletions
diff --git a/src/log/log.cpp b/src/log/log.cpp
index 7ed4ab2..f890ba2 100644
--- a/src/log/log.cpp
+++ b/src/log/log.cpp
@@ -321,5 +321,11 @@ void log_print(enum log_level level, const char *module, const char *fmt, ...)
{
nwrite = write(g_log_ctx->log_fd, buf, p - buf);
} while (nwrite == -1 && errno == EINTR);
+
+ // log level is LOG_STATE, also print to stderr
+ if (level == LOG_STATE)
+ {
+ fprintf(stderr, "%s", buf);
+ }
}
} \ No newline at end of file
diff --git a/src/packet_io/dumpfile_io.cpp b/src/packet_io/dumpfile_io.cpp
index ba2c288..9e126a6 100644
--- a/src/packet_io/dumpfile_io.cpp
+++ b/src/packet_io/dumpfile_io.cpp
@@ -205,7 +205,7 @@ static void *dumpfile_thread(void *arg)
ATOMIC_SET(&handle->io_thread_wait_exit, 1);
}
- PACKET_IO_LOG_STATE("dumpfile io thread waiting exit");
+ PACKET_IO_LOG_STATE("dumpfile io thread has processed all pcap files, wait for exit");
sleep(1);
}
diff --git a/src/stellar/stellar_core.cpp b/src/stellar/stellar_core.cpp
index 9713417..80f437c 100644
--- a/src/stellar/stellar_core.cpp
+++ b/src/stellar/stellar_core.cpp
@@ -403,7 +403,7 @@ static void stellar_thread_clean(struct stellar_runtime *runtime, struct stellar
struct stellar_thread *thread = &runtime->threads[i];
if (ATOMIC_READ(&thread->is_runing) == 0)
{
- STELLAR_LOG_STATE("wait worker thread %d free context", i);
+ STELLAR_LOG_STATE("clean worker thread %d context", i);
session_manager_free(thread->sess_mgr);
ip_reassembly_free(thread->ip_mgr);
}