TheMDC
manages contextual information on a per thread basis. A child thread automatically inherits a copy of the mapped diagnostic context of its parent. Typically, while starting to service a new client request, the developer will insert pertinent contextual information, such as the client id, client's IP address, request parameters etc. into theMDC
. Logback components, if appropriately configured, will automatically include this information in each log entry.
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/_mOOuQu2SXcJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
On Thu, 2012-07-26 at 08:26 +0200, Patrik Nordwall wrote:But it would be awesome if the akka async logger would have an API to
> In case you didn't notice we answered a question about MDC a few days
> ago. Yes, it's not possible to use MDC with akka's async logging.
emulate the MDC.
I partially solved the issue (I was trying to assign somewhat unique ids
to messages sent and was planning to use the MDC to decorate my actor
receive log entries with this id) by (ab)using a custom LogSource that
decorates the ActorRef/Actor LogSource string result with this message
id. I feel dirty :)
--
Brice Figureau
My Blog: http://www.masterzen.fr/
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
I thought ThreadLocal storage should not be used with Akka. Seems likely that MDC uses ThreadLocal storage. Am I wrong, or are there caveats regarding when ThreadLocal is a good/bad idea with Akka?
I missed the mentions of MDC in the previous threads, so I took a look. I did not see any cautions mentioned about this in those threads.
Mike
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/4BflVjfHtrAJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
I thought ThreadLocal storage should not be used with Akka. Seems likely that MDC uses ThreadLocal storage.
Am I wrong, or are there caveats regarding when ThreadLocal is a good/bad idea with Akka?
I missed the mentions of MDC in the previous threads, so I took a look. I did not see any cautions mentioned about this in those threads.
Mike
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/4BflVjfHtrAJ.
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
Unfortunately this breaks the Java logging API in a bad way.
So back to the drawing board, what about:
val mdc = LoggingContext
val log = Logging(context.system, this, mdc)
...
mdc.put("akka", "is great!")
log.info("hello world!")
mdc.remove("akka")
...
With info implemented as:
def info(message: String) { if (isInfoEnabled) notifyInfo(message, mdc) }
(where mdc would be a field in the trait)
Would that work?
Anyway, I'm open to any suggestions at that point :)
-->>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
Patrik Nordwall
Typesafe - The software stack for applications that scale
Twitter: @patriknw
Hi,
There was some activity on this subject recently. I've written something about it.
http://ktonga.tumblr.com/post/67780441208/akka-meets-mdc
Hope it helps.
Gaston.