Hi,

As you can see in the blog post, it should work.

Let me try on Karaf 4.3.4 quickly.

I will let you know.

Regards
JB

On 04/01/2022 10:42, Jürgen Weber wrote:
This is about openHAB 3.2 which uses Karaf 4.3.4 and Pax logging.

The idea is to put data into an MDC in a bundle and use it for log4j2 routes.

I tried this in a Java main sample and it works:

MDC.put("ohtopic", "openhab/items/XLevel/state");

<Routes pattern="$${ctx:ohtopic}">
<Route key="openhab/items/XLevel/state" ref="FILE1">
</Route>

But not within openHAB / karaf, there only the bundle id etc. appear
in log4j2 (as shown with %X pattern).

Thanks,
Juergen

Am Di., 4. Jan. 2022 um 09:53 Uhr schrieb Jean-Baptiste Onofré
<j...@nanthrax.net>:

Hi,

Are you using the SIFT appender ?

Which Karaf version are you using ?

Does it mean that you set a MDC property that you don't see later on ?

Are you using something similar to:

https://nanthrax.blogspot.com/2014/08/mdc-logging-with-apache-karaf-and-camel_31.html

aka MDC.put("foo", "bar"); ?

?

Regards
JB

On 03/01/2022 22:32, Jürgen Weber wrote:
Seems if a user code in a bundle sets a logging MDC it gets deleted/is
lost? by Karaf. Is this indeed the case? by design?

%X in the appender pattern shows only

{bundle.id=175, bundle.name=org.openhab.core.io.monitor, bundle.version=3.2.0}

Thanks,
Juergen

Reply via email to