diff OrthancServer/Sources/ServerContext.cpp @ 5450:9ffd6d18daf3 pg-transactions

log lines now contain the thread name
author Alain Mazy <am@osimis.io>
date Tue, 05 Dec 2023 16:26:35 +0100
parents ac68a4383e51
children 38f1d06875ad 48b8dae6dc77
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp	Wed Nov 29 09:28:21 2023 +0100
+++ b/OrthancServer/Sources/ServerContext.cpp	Tue Dec 05 16:26:35 2023 +0100
@@ -112,6 +112,8 @@
   void ServerContext::MemoryTrimmingThread(ServerContext* that,
                                            unsigned int intervalInSeconds)
   {
+    Logging::SetCurrentThreadName("MEMORY-TRIM");
+
     boost::posix_time::ptime lastExecution = boost::posix_time::second_clock::universal_time();
 
     // This thread is started only if malloc_trim is defined
@@ -140,6 +142,8 @@
   void ServerContext::ChangeThread(ServerContext* that,
                                    unsigned int sleepDelay)
   {
+    Logging::SetCurrentThreadName("CHANGES");
+
     while (!that->done_)
     {
       std::unique_ptr<IDynamicObject> obj(that->pendingChanges_.Dequeue(sleepDelay));
@@ -182,6 +186,8 @@
   void ServerContext::JobEventsThread(ServerContext* that,
                                       unsigned int sleepDelay)
   {
+    Logging::SetCurrentThreadName("JOB-EVENTS");
+
     while (!that->done_)
     {
       std::unique_ptr<IDynamicObject> obj(that->pendingJobEvents_.Dequeue(sleepDelay));
@@ -224,6 +230,8 @@
   void ServerContext::SaveJobsThread(ServerContext* that,
                                      unsigned int sleepDelay)
   {
+    Logging::SetCurrentThreadName("SAVE-JOBS");
+
     static const boost::posix_time::time_duration PERIODICITY =
       boost::posix_time::seconds(10);