You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Lorenz Quack <qu...@gmail.com> on 2017/04/03 08:18:54 UTC

Re: Logging ThreadId in Java broker logs

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: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Logging ThreadId in Java broker logs

Posted by Ramayan Tiwari <ra...@gmail.com>.
Hi Lorenz,

Thanks so much for your response. I am playing with the housekeeping task
in terms of number of threads and frequency, to get to a reasonable number
for our use case. Its very hard to relate to which thread did what by only
looking at the thread name (by simple fact that name is not sufficient to
identify a thread over a period of time). Other than that, it also helps us
align with the logging that we do at our product level, and the tooling
that we have to log mine (which works by thread Id).

I will try to use customConversionSpecifier.

Thanks
Ramayan

On Mon, Apr 3, 2017 at 4:09 AM, Lorenz Quack <qu...@gmail.com> wrote:

> 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: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Re: Logging ThreadId in Java broker logs

Posted by Lorenz Quack <qu...@gmail.com>.
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: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org