logback / LOGBACK-1722 [Open] Provide conversion word for thread id (not just thread name)
============================== Here's what changed in this issue in the last few minutes. This issue has been created This issue is now assigned to you. View or comment on issue using this link https://jira.qos.ch/browse/LOGBACK-1722 ============================== Issue created ------------------------------ Marcin Zajączkowski created this issue on 30/Jan/23 11:47 PM Summary: Provide conversion word for thread id (not just thread name) Issue Type: Improvement Affects Versions: 1.4.5 Assignee: Logback dev list Components: logback-core Created: 30/Jan/23 11:47 PM Priority: Minor Reporter: Marcin Zajączkowski Description: Logback provides *t / thread* to get a thread name, in some cases it isn't enough to distinguish threads in logs. For example Spring Cloud Binder Kafka uses the following thread naming format: {code:java} KafkaConsumerDestination{consumerDestinationName='some-topic', partitions=1, dlqName='some-others-dlq'}.container-0-C-1 {code} where the last 15 characters is meaningless, but also using the full thread name in logs would decrease its readability. While possibly it would be possible to tweaks those threads name, to trace the concurrent actions it would be enough to have its ID displayed in the next field defined in the logging pattern. Unfortunately, it seems that logback doesn't provide a built-in way to get the thread id (not just name). My proposal is to add an extra conversion word(s): *tid / threadId* to internally use currentThread.getId(). I initially looked at the converter infrastructure, however, the thread name is kept in the event. I don't know if the thread id would need to be also placed there, or maybe it is possible to achieve in some easier way? ============================== This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59) _______________________________________________ logback-dev mailing list logback-dev@qos.ch https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-dev