Andrey Tabakov
05/04/2023, 3:11 PM-Dkotlinx.coroutines.debug , but what to do in prod?simon.vergauwen
05/04/2023, 3:16 PMCoroutineName.simon.vergauwen
05/04/2023, 3:16 PMAndrey Tabakov
05/04/2023, 3:18 PMAndrey Tabakov
05/04/2023, 3:19 PMCoroutineScope(
        Dispatchers.Default +
        CoroutineName("SubscriptionManager")
)Andrey Tabakov
05/04/2023, 3:20 PM<pattern>%d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
 (I assume that thread name not changed)Youssef Shoaib [MOD]
05/04/2023, 4:08 PMsimon.vergauwen
05/04/2023, 4:10 PMThread.name which is probably why it works with [%thread] 🤔Andrey Tabakov
05/04/2023, 4:12 PMDefaultDispatcher-worker-1 , I don't understand why not coroutineName, what disadvantages of it?simon.vergauwen
05/04/2023, 4:13 PMDefaultDispatcher-worker-1 is set by the ThreadFactory, and. logback never interacts with CoroutineContext so it doesn't know about CoroutineName.
ThreadFactory is also not aware of the CoroutineContext, so it cannot easily do thatAndrey Tabakov
05/04/2023, 4:13 PMYoussef Shoaib [MOD]
05/04/2023, 4:14 PMAndrey Tabakov
05/04/2023, 4:16 PMYoussef Shoaib [MOD]
05/04/2023, 4:23 PMAndrey Tabakov
05/04/2023, 4:32 PMMichael Strasser
05/05/2023, 1:42 AM@coroutine#41) but others do not.
I have modified Klogging to read coroutine name from the current context and add it if present. The current snapshot build constructs a context string like DefaultDispatcher-worker-1+SubscriptionManager if SubscriptionManager is set as the coroutine name.
Let me know if this is helpful.Michael Strasser
05/05/2023, 1:02 PM