Logging Task Ids from ActiveMQ broker to the producer application

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Logging Task Ids from ActiveMQ broker to the producer application

snekam
I am running ActiveMQ 5.15.5 as a standalone broker and my spring application
is connecting to it.
I wanted to know if I can log the Task-ID that the broker logs, in the
client application logs.

Currently application logs look like:
INFO ] 2018-11-29 09:52:19,144 [ActiveMQ Session Task] ....
[INFO ] 2018-11-29 09:52:19,168 [ActiveMQ Session Task] ...
[INFO ] 2018-11-29 09:52:19,199 [ActiveMQ Session Task] ....

I believe if I had embedded activeMQ the logs would look like  
INFO ] 2018-11-29 09:52:19,144 [ActiveMQ Session Task-9] ....
[INFO ] 2018-11-29 09:52:19,168 [ActiveMQ Session Task-9] ...

Looking at the client application logs, i do not have a way to categorize
transactions by multiple users as they are all logged as "ActiveMQ Session
Task"

Is there a way to log the Task-ID from broker (I do see the Task-ID at the
broker logs activemq.log) in the client logs.
I tried to set the ActiveMQ logs in the client log4j.xml to info with no
luck.

Thanks



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: Logging Task Ids from ActiveMQ broker to the producer application

Tim Bain
Those are the names of the threads within the broker JVM, so no, there is
not a way to get them into the client logs.

This feels like an XY problem (http://xyproblem.info), so what are you
actually trying to do? Maybe there's a different way to do it than the one
you've thought of.

Tim

On Thu, Nov 29, 2018, 10:27 AM snekam <[hidden email] wrote:

> I am running ActiveMQ 5.15.5 as a standalone broker and my spring
> application
> is connecting to it.
> I wanted to know if I can log the Task-ID that the broker logs, in the
> client application logs.
>
> Currently application logs look like:
> INFO ] 2018-11-29 09:52:19,144 [ActiveMQ Session Task] ....
> [INFO ] 2018-11-29 09:52:19,168 [ActiveMQ Session Task] ...
> [INFO ] 2018-11-29 09:52:19,199 [ActiveMQ Session Task] ....
>
> I believe if I had embedded activeMQ the logs would look like
> INFO ] 2018-11-29 09:52:19,144 [ActiveMQ Session Task-9] ....
> [INFO ] 2018-11-29 09:52:19,168 [ActiveMQ Session Task-9] ...
>
> Looking at the client application logs, i do not have a way to categorize
> transactions by multiple users as they are all logged as "ActiveMQ Session
> Task"
>
> Is there a way to log the Task-ID from broker (I do see the Task-ID at the
> broker logs activemq.log) in the client logs.
> I tried to set the ActiveMQ logs in the client log4j.xml to info with no
> luck.
>
> Thanks
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Logging Task Ids from ActiveMQ broker to the producer application

snekam
I am trying to trace the lifetime of a message in the client application log.
That is in my application's onMessage(Message p_message) method I have
different log statements which
get printed under the thread ID: "ActiveMQ Session Task".
Like below:
[INFO ] 2018-11-27 16:29:57,642 [ActiveMQ Session Task] HydrationServiceImpl
- ===>  START: dehydrate
[INFO ] 2018-11-27 16:29:57,642 [ActiveMQ Session Task] HydrationDaoImpl -
==> START: countCor
[INFO ] 2018-11-27 16:29:57,649 [ActiveMQ Session Task] HydrationDaoImpl -
==> END: countCor
[INFO ] 2018-11-27 16:29:57,649 [ActiveMQ Session Task] HydrationDaoImpl -
==> START: purge for id = 82559
[INFO ] 2018-11-27 16:29:57,664 [ActiveMQ Session Task] HydrationDaoImpl -
==> END: purge
[INFO ] 2018-11-27 16:29:57,664 [ActiveMQ Session Task] HydrationServiceImpl
- ==> END: dehydrate


So if more than 1 message is being worked on then all get the same thread
ID:- [ActiveMQ Session Task]

Thus there is no way for me to categorize the logs for different messages.

Is there a way to be able to tell, for which message consume is the log
statement for?




--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: Logging Task Ids from ActiveMQ broker to the producer application

Tim Bain
So these are all custom log messages over which you have control? Can you
simply add the JMSMessageID to each one? Or put it into the MDC (
https://logging.apache.org/log4j/2.x/manual/thread-context.html, or
https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/MDC.html if
you're using Log4J 1.x)?

Tim

On Mon, Dec 3, 2018, 10:19 AM snekam <[hidden email] wrote:

> I am trying to trace the lifetime of a message in the client application
> log.
> That is in my application's onMessage(Message p_message) method I have
> different log statements which
> get printed under the thread ID: "ActiveMQ Session Task".
> Like below:
> [INFO ] 2018-11-27 16:29:57,642 [ActiveMQ Session Task]
> HydrationServiceImpl
> - ===>  START: dehydrate
> [INFO ] 2018-11-27 16:29:57,642 [ActiveMQ Session Task] HydrationDaoImpl -
> ==> START: countCor
> [INFO ] 2018-11-27 16:29:57,649 [ActiveMQ Session Task] HydrationDaoImpl -
> ==> END: countCor
> [INFO ] 2018-11-27 16:29:57,649 [ActiveMQ Session Task] HydrationDaoImpl -
> ==> START: purge for id = 82559
> [INFO ] 2018-11-27 16:29:57,664 [ActiveMQ Session Task] HydrationDaoImpl -
> ==> END: purge
> [INFO ] 2018-11-27 16:29:57,664 [ActiveMQ Session Task]
> HydrationServiceImpl
> - ==> END: dehydrate
>
>
> So if more than 1 message is being worked on then all get the same thread
> ID:- [ActiveMQ Session Task]
>
> Thus there is no way for me to categorize the logs for different messages.
>
> Is there a way to be able to tell, for which message consume is the log
> statement for?
>
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Logging Task Ids from ActiveMQ broker to the producer application

snekam
yes these are custom logs that I can control. so seems like MDC can solve my
problem. will start looking into it. thanks for the suggestion/solution!



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html