Hi Ramayan,

Sorry, I might have been partially mistaken in my previous response.
No two threads should have the same name at the same time.
If that would be the case that would be a bug.

However, it is possible that a thread switches names and assumes a name a different thread held previously. This is completely expected and it is not clear to me why this would be a problem. For example, Thread1 picks up the filesystem checking houskeeping task and switches its name to "FileSystemSpaceChecker["myVH"]". After it performed that work it picks up a different task (for example checking Queues and Transactions) and switches to "Housekeeping["myVH"]". In the meantime a second thread Thread2 can come along and pick up the filesystem checking task again renaming itself to "FileSystemSpaceChecker["myVH"]".
In essence a thread is named after the task it is currently performing.

The same thing happens with connections where a thread from a thread pool services one set of IO operations on a connection before returning to the pool. The next set of IO operations on the same connection might be serviced by a completely different thread but it will assume the same name.

May I ask why you want to identify a thread beyond the task that it is performing?

Kind regards,
Lorenz


On 03/04/17 09:18, Lorenz Quack wrote:
Hi,

I have not tried this before but a quick web search suggests [1, 2] you could achieve this by means of a custom converter. Regarding Houskeeping threads sharing the same name, on trunk this should no longer be the case. If you encounter other thread pools with this behaviour please flag it up so we can make sure it has been fixed on trunk.

Kind regards,
Lorenz

[1] http://logback.10977.n7.nabble.com/Pattern-log-thread-id-instead-of-thread-name-td459.html
[2] https://logback.qos.ch/manual/layouts.html#customConversionSpecifier

On 31/03/17 20:57, Ramayan Tiwari wrote:
Hi All,

After looking logback's PatternLayout, I don't think its possible to log
thread id by simply supplying a pattern for it. Has anyone looked into ways
to achieve it?

I would like to have thread ids in the log lines as well, since it appears
to be me that same thread name gets assigned for multiple threads (eg,
housekeeping task). Please correct me if that is not the case.

Thanks
Ramayan




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to