[ 
https://issues.apache.org/jira/browse/GEODE-10016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17488547#comment-17488547
 ] 

ASF GitHub Bot commented on GEODE-10016:
----------------------------------------

mmartell commented on a change in pull request #918:
URL: https://github.com/apache/geode-native/pull/918#discussion_r801207475



##########
File path: cppcache/src/Log.cpp
##########
@@ -378,12 +421,21 @@ std::string Log::formatLogLine(LogLevel level) {
       now - std::chrono::system_clock::from_time_t(secs));
   auto tm_val = apache::geode::util::chrono::localtime(secs);
 
+  std::thread::id id = std::this_thread::get_id();
+  std::stringstream ss;
+  ss << id;
+  std::string threadIdWithName;
+  if (getThreadName() != "") {
+    threadIdWithName = ss.str() + " (" + getThreadName() + ")";
+  } else {
+    threadIdWithName = ss.str();
+  }
+
   msg << "[" << Log::levelToChars(level) << " "
       << std::put_time(&tm_val, "%Y/%m/%d %H:%M:%S") << '.' << 
std::setfill('0')
       << std::setw(6) << microseconds.count() << ' '
       << std::put_time(&tm_val, "%z  ") << g_hostName << ":"
-      << boost::this_process::get_id() << " " << std::this_thread::get_id()
-      << "] ";
+      << boost::this_process::get_id() << " " << threadIdWithName << "] ";

Review comment:
       Good catch. Done.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@geode.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Use Thread Name In Log Messages
> -------------------------------
>
>                 Key: GEODE-10016
>                 URL: https://issues.apache.org/jira/browse/GEODE-10016
>             Project: Geode
>          Issue Type: Improvement
>          Components: native client
>            Reporter: Michael Martell
>            Priority: Minor
>              Labels: pull-request-available
>
> The native client logging system currently prints the threadId in all log 
> messages. Since all internally created native client threads are named, we 
> should print the threadName instead of threadId. This will be extremely 
> helpful to understanding the flow of messages since there are many background 
> threads in the native client.
> Note: Lots of log messages are running on an application thread which was not 
> created internally by the native client. Messages running on these threads 
> should continue to print the threadId.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to