AFAIC, your reasoning on why m:testkey not working is correct. Why don't you create your own PatternConverter rather than using a custom lookup?
Additionally, if your log sink accepts JSON, you can introduce a custom resolver to JsonTemplateLayout too -- though note that this feature will be available with the upcoming 2.5.0 release. On Fri, 9 Apr 2021, 18:01 Lars-Fredrik Smedberg <itsme...@gmail.com> wrote: > Hi! > > We are using different appenders with a pattern layout that both read > values from ThreadContext using %X and through a custom lookup that > internally access the ThreadContext > > If we use a pattern such as "%X{testkey} $${m:testkey} %m" (the lookup > assigned to prefix m access the same key from the ThreadContext) and then > use our appender in an AsyncLogger then we get the correct value for the > %X{testkey} but not for $${m:testkey}. > > I assume the message is formatted on the caller thread but that the lookup > part of the pattern is resolved on the async thread since it does not seem > to find the key in the ThreadContext inside our lookup class? > > Is the above the root cause to our problem? Is there a way around this? We > really would like to use our custom lookup that use ThreadContext with > async loggers. > > Any help would be greatly apreciated > Best regards > LF > > -- > Med vänlig hälsning / Best regards > > Lars-Fredrik Smedberg > > STATEMENT OF CONFIDENTIALITY: > The information contained in this electronic message and any > attachments to this message are intended for the exclusive use of the > address(es) and may contain confidential or privileged information. If > you are not the intended recipient, please notify Lars-Fredrik Smedberg > immediately at itsme...@gmail.com, and destroy all copies of this > message and any attachments. >