Skip to content

Commit 4951c9d

Browse files
committed
CAMEL-16861: Update docs
1 parent da45558 commit 4951c9d

3 files changed

Lines changed: 277 additions & 63 deletions

File tree

docs/user-manual/modules/ROOT/pages/mdc.adoc

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,47 @@
22

33
The Mapped Diagnostic Context is a technology used in Java to provide a set of customized information into each log trace. The major logging frameworks implements it, and, although it may have certain limitations, this technology is used to enhance the logging and monitoring of a Java application (Camel applications included).
44

5-
NOTE: you're invited to try the new ref:components::mdc-component.adoc[camel-mdc] component for an improved user experience.
5+
TIP: You're invited to try the new xref:components:others:mdc.adoc[camel-mdc] component for an improved user experience.
66

77
The main limitation of this technology is the fact that it stores values on a context that is available at thread level. Since Camel is an application that manages multiple thread, when it deals with asynchronous calls, the context propagation may not work correctly.
88

9-
NOTE: the framework should generally handle MDC correctly. However, there could be components (eg, tracing components) and other asynchronous parts of the system that still require the implementation of the context propagation: please report if you notice anything wrong.
9+
NOTE: The framework should generally handle MDC correctly. However, there could be components (eg, tracing components) and other asynchronous parts of the system that still require the implementation of the context propagation: please report if you notice anything wrong.
1010

11-
== How to configure in Camel application
11+
== Enabling MDC
1212

13-
The first thing you need to do is to enable the `camel.main.useMdcLogging=true`. This flag will automatically include in the MDC context the following Exchange information:
13+
NOTE: Using the new xref:components:others:mdc.adoc[camel-mdc] will automatic enabled MDC logging in Camel.
14+
15+
The first thing you need to do is to enable MDC logging in Camel.
16+
17+
[tabs]
18+
====
19+
20+
Application Properties::
21+
+
22+
[source,properties]
23+
----
24+
camel.main.useMdcLogging = true
25+
----
26+
27+
Java::
28+
+
29+
[source,java]
30+
----
31+
CamelContext context = ...
32+
context.setUseMDCLogging(true);
33+
----
34+
35+
Spring XML::
36+
+
37+
[source,xml]
38+
----
39+
<camelContext xmlns="http://camel.apache.org/schema/spring" useMDCLogging="true">
40+
...
41+
</camelContext>
42+
----
43+
====
44+
45+
When enabled then the following Camel information will be included in the MDC context:
1446

1547
* camel.breadcrumbId
1648
* camel.exchangeId
@@ -27,9 +59,9 @@ You can use the above variables for MDC depending on the logging framework you'r
2759

2860
If you're using Java DSL you can include any customized information by adding that using low level MDC API:
2961

30-
[source, java]
62+
[source,java]
3163
----
32-
org.slf4j.MDC.put("myKey", "myValue");
64+
org.slf4j.MDC.put("myKey", "myValue");
3365
----
3466

3567
Each MDC should be now able to include that information.

docs/user-manual/modules/ROOT/pages/migration-app-note.adoc

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)