This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch faq in repository https://gitbox.apache.org/repos/asf/camel.git
commit a609828baa15e406050765b8988eb792e27f7a85 Author: Claus Ibsen <[email protected]> AuthorDate: Tue Mar 3 19:57:28 2026 +0100 CAMEL-16861: Cleanup docs --- .../modules/ROOT/pages/stream-caching.adoc | 42 +++++++++++++++++ docs/user-manual/modules/faq/nav.adoc | 4 -- .../modules/faq/pages/how-do-i-debug-my-route.adoc | 14 ------ .../modules/faq/pages/how-do-i-disable-jmx.adoc | 38 --------------- .../faq/pages/how-do-i-enable-debug-logging.adoc | 32 ------------- ...reams-when-debug-logging-messages-in-camel.adoc | 54 ---------------------- docs/user-manual/modules/faq/pages/index.adoc | 4 -- ...-file-consumer-use-the-camel-error-handler.adoc | 2 - 8 files changed, 42 insertions(+), 148 deletions(-) diff --git a/docs/user-manual/modules/ROOT/pages/stream-caching.adoc b/docs/user-manual/modules/ROOT/pages/stream-caching.adoc index c3f3fc5d525c..cacd2bf15244 100644 --- a/docs/user-manual/modules/ROOT/pages/stream-caching.adoc +++ b/docs/user-manual/modules/ROOT/pages/stream-caching.adoc @@ -338,3 +338,45 @@ from("direct:start") .process(new StreamCachingProcessor()) .to("log:cached"); ---- + +== How do I enable streams when debug logging messages in Camel + +When you run Camel with `DEBUG` level as logging, it will log the +messages and its content from time to time. +As some messages can contain streams, which are prone to be not readable +multiple times, and therefore Camel will by default *not* log these +types. + +These are typical instances which are not logged by default: + +* `java.xml.transform.StreamSource` +* `java.io.InputStream` +* `java.io.OutputStream` +* `java.io.Reader` +* `java.io.Writer` + +You will see this in the log as: + +[source,log] +---- +DEBUG ProducerCache - >>>> Endpoint[direct:start] Exchange[Message: [Body is instance of java.xml.transform.StreamSource]] +---- + +Here we have a message which is XML stream based. +You can customize whether Camel should log the payload anyway. + +You can enable this as a global option on `CamelContext` from Java: + +[source,java] +---- +context.getGlobalOptions().put(Exchange.LOG_DEBUG_BODY_STREAMS, "true"); +---- + +In `application.properties` this can also be done as shown: + +[source,properties] +---- +camel.main.globalOptions[CamelLogDebugBodyStreams] = true +---- + +Notice default is `false`. diff --git a/docs/user-manual/modules/faq/nav.adoc b/docs/user-manual/modules/faq/nav.adoc index 714294e47bda..89ff48ab5ff0 100644 --- a/docs/user-manual/modules/faq/nav.adoc +++ b/docs/user-manual/modules/faq/nav.adoc @@ -16,9 +16,6 @@ ** xref:how-do-i-specify-which-method-to-use-when-using-beans-in-routes.adoc[How do I specify which method to use when using beans in routes?] ** xref:how-can-i-create-a-custom-component-or-endpoint.adoc[How can I create a custom component or endpoint?] ** xref:how-does-camel-look-up-beans-and-endpoints.adoc[How does Camel look up beans and endpoints?] -** xref:how-do-i-debug-my-route.adoc[How do I debug my route?] -** xref:how-do-i-disable-jmx.adoc[How do I disable JMX?] -** xref:how-do-i-enable-streams-when-debug-logging-messages-in-camel.adoc[How do I enable streams when debug logging messages in Camel?] ** xref:how-do-i-handle-failures-when-consuming-for-example-from-a-ftp-server.adoc[How do I handle failures when consuming for example from a FTP server?] ** xref:how-do-i-import-rests-from-other-xml-files.adoc[How do I import rests from other XML files?] ** xref:how-do-i-import-routes-from-other-xml-files.adoc[How do I import routes from other XML files?] @@ -50,7 +47,6 @@ ** xref:why-is-my-processor-not-showing-up-in-jconsole.adoc[Why is my processor not showing up in JConsole?] ** xref:why-is-the-exception-null-when-i-use-onexception.adoc[Why is the exception null when I use onException?] ** xref:why-use-multiple-camelcontext.adoc[Why use multiple CamelContext?] -** xref:how-do-i-enable-debug-logging.adoc[How do I enable debug logging?] ** xref:how-do-i-use-log4j.adoc[How do I use log4j?] ** xref:how-do-i-make-my-jms-endpoint-transactional.adoc[How Do I Make My JMS Endpoint Transactional?] ** xref:how-do-i-set-the-mep-when-interacting-with-jbi.adoc[How do I set the MEP when interacting with JBI?] diff --git a/docs/user-manual/modules/faq/pages/how-do-i-debug-my-route.adoc b/docs/user-manual/modules/faq/pages/how-do-i-debug-my-route.adoc deleted file mode 100644 index 5e97aa2209a2..000000000000 --- a/docs/user-manual/modules/faq/pages/how-do-i-debug-my-route.adoc +++ /dev/null @@ -1,14 +0,0 @@ -= How do I debug my route? - -If you've created a route and its not doing what you think it is you -could try using one of these features from version 1.4 onwards: - -* xref:ROOT:tracer.adoc[Tracer] to trace in commons-logging / log4j each step -that Camel takes -* xref:ROOT:debugger.adoc[Debugger] to let you set breakpoints at points in -the route and examine historic message exchanges -* xref:ROOT:debugger.adoc[Debug] from your unit test if you use the Camel -`camel-test` component - -Some link:/community/user-stories/[third party tools] offer Apache Camel route -debugging. diff --git a/docs/user-manual/modules/faq/pages/how-do-i-disable-jmx.adoc b/docs/user-manual/modules/faq/pages/how-do-i-disable-jmx.adoc deleted file mode 100644 index f10eacb2eff3..000000000000 --- a/docs/user-manual/modules/faq/pages/how-do-i-disable-jmx.adoc +++ /dev/null @@ -1,38 +0,0 @@ -= How do I disable JMX? - -== How do I disable JMX since Camel 3.x - -JMX is disabled by default, and only enabled if `camel-management` -is on the classpath. So an easy way to disable JMX is to _not_ include this JAR. - -You can also turn off JMX as shown below. - -== How do I disable JMX in Camel 2.x - -You can disable JMX instrumentation agent by setting Java VM system -property as follow. The property value is treated as boolean. - -[source,java] ----- --Dorg.apache.camel.jmx.disabled=true ----- - -Or, by adding a jmxAgent element inside the camelContext element in -Spring configuration: - -[source,xml] ----- -<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> - <jmxAgent id="agent" disabled="true"/> - ... -</camelContext> ----- - -Or in Camel 2.1 its a bit easier (not having to use JVM system property) -if using pure Java as you can disable it as follows: - -[source,java] ----- -CamelContext camel = new DefaultCamelContext(); -camel.disableJMX(); ----- diff --git a/docs/user-manual/modules/faq/pages/how-do-i-enable-debug-logging.adoc b/docs/user-manual/modules/faq/pages/how-do-i-enable-debug-logging.adoc deleted file mode 100644 index 400135747e79..000000000000 --- a/docs/user-manual/modules/faq/pages/how-do-i-enable-debug-logging.adoc +++ /dev/null @@ -1,32 +0,0 @@ -= How do I enable debug logging? - -Camel uses convention over configuration so sometimes it's useful to turn -on debug logging to see how Camel is operating and to try and diagnose -issues. - -Camel uses http://www.slf4j.org/[sfl4j] which allows you to configure -logging via, among others: - -* http://logging.apache.org/log4j/[Log4j] -* http://logback.qos.ch/[Logback] -* https://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html[JDK Util Logging logging] - -To enable debug logging we recommend you -xref:how-do-i-use-log4j.adoc[use log4j for logging] then make sure your -log4j.properties file enables DEBUG level logging for the -`org.apache.camel` package. - -For example here is a `log4j.properties` file with debug Camel logging: -enabled - -[source,java] ----- -log4j.rootLogger=INFO, out - -log4j.logger.org.apache.camel=DEBUG - -log4j.appender.out=org.apache.log4j.ConsoleAppender -log4j.appender.out.layout=org.apache.log4j.PatternLayout -log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n -#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n ----- diff --git a/docs/user-manual/modules/faq/pages/how-do-i-enable-streams-when-debug-logging-messages-in-camel.adoc b/docs/user-manual/modules/faq/pages/how-do-i-enable-streams-when-debug-logging-messages-in-camel.adoc deleted file mode 100644 index dea7748061e3..000000000000 --- a/docs/user-manual/modules/faq/pages/how-do-i-enable-streams-when-debug-logging-messages-in-camel.adoc +++ /dev/null @@ -1,54 +0,0 @@ -= How do I enable streams when debug logging messages in Camel - -*Since Camel 2.1* - -When you run Camel with `DEBUG` level as logging, it will log the -messages and its content from time to time. -As some messages can contain streams, which are prone to be not readable -multiple times, and therefore Camel will by default *not* log these -types. - -These instances are not logged by default: - -* `java.xml.transform.StreamSource` -* `java.io.InputStream` -* `java.io.OutputStream` -* `java.io.Reader` -* `java.io.Writer` - -You will see this in the log as: - ----- -DEBUG ProducerCache - >>>> Endpoint[direct:start] Exchange[Message: [Body is instance of java.xml.transform.StreamSource]] ----- - -Here we have a message which is XML stream based. -You can customize whether Camel should log the payload anyway. - -[[HowdoIenablestreamswhendebugloggingmessagesinCamel-CustomizingfromJavaDSL]] -== Customizing from Java DSL - -You add to the Camel properties the flag to log streams. - -[source,java] ----- - context.getGlobalOptions().put(Exchange.LOG_DEBUG_BODY_STREAMS, "true"); ----- - -Notice default is `false`. - -[[HowdoIenablestreamswhendebugloggingmessagesinCamel-CustomizingfromSpringDSL]] -== Customizing from Spring DSL - -You add to the Camel properties the flag to log streams. - -[source,java] ----- - <camelContext> - <properties> - <property key="CamelLogDebugBodyStreams" value="true"/> - </properties> - </camelContext> ----- - -Notice default is `false`. diff --git a/docs/user-manual/modules/faq/pages/index.adoc b/docs/user-manual/modules/faq/pages/index.adoc index ce28e6300339..460b84ab2416 100644 --- a/docs/user-manual/modules/faq/pages/index.adoc +++ b/docs/user-manual/modules/faq/pages/index.adoc @@ -37,9 +37,6 @@ Questions on using Apache Camel * xref:how-do-i-specify-which-method-to-use-when-using-beans-in-routes.adoc[How do I specify which method to use when using beans in routes?] * xref:how-can-i-create-a-custom-component-or-endpoint.adoc[How can I create a custom component or endpoint?] * xref:how-does-camel-look-up-beans-and-endpoints.adoc[How does Camel look up beans and endpoints?] -* xref:how-do-i-debug-my-route.adoc[How do I debug my route?] -* xref:how-do-i-disable-jmx.adoc[How do I disable JMX?] -* xref:how-do-i-enable-streams-when-debug-logging-messages-in-camel.adoc[How do I enable streams when debug logging messages in Camel?] * xref:how-do-i-handle-failures-when-consuming-for-example-from-a-ftp-server.adoc[How do I handle failures when consuming for example from a FTP server?] * xref:how-do-i-import-rests-from-other-xml-files.adoc[How do I import rests from other XML files?] * xref:how-do-i-import-routes-from-other-xml-files.adoc[How do I import routes from other XML files?] @@ -79,7 +76,6 @@ Questions on using Apache Camel Questions on logging output from Camel to a console, using the xref:components::log-component.adoc[Log] endpoint or JDK 1.4 logging or Log4j etc -* xref:how-do-i-enable-debug-logging.adoc[How do I enable debug logging?] * xref:how-do-i-use-log4j.adoc[How do I use log4j?] [[FAQ-CamelEndpointQuestions]] diff --git a/docs/user-manual/modules/faq/pages/why-does-my-file-consumer-not-pick-up-the-file-and-how-do-i-let-the-file-consumer-use-the-camel-error-handler.adoc b/docs/user-manual/modules/faq/pages/why-does-my-file-consumer-not-pick-up-the-file-and-how-do-i-let-the-file-consumer-use-the-camel-error-handler.adoc index 454dfc5b924d..c7f59334521c 100644 --- a/docs/user-manual/modules/faq/pages/why-does-my-file-consumer-not-pick-up-the-file-and-how-do-i-let-the-file-consumer-use-the-camel-error-handler.adoc +++ b/docs/user-manual/modules/faq/pages/why-does-my-file-consumer-not-pick-up-the-file-and-how-do-i-let-the-file-consumer-use-the-camel-error-handler.adoc @@ -5,8 +5,6 @@ not picking up files. For example it may not run at all, or it cannot acquire a read lock on the file. xref:index.adoc#FAQ-LoggingQuestions[Check the logs] for any exceptions or other informative messages. You can -xref:how-do-i-enable-debug-logging.adoc[turn on DEBUG logging] at -`org.apache.camel.component.file` to see more detail. [[WhydoesmyfileconsumernotpickupthefileandhowdoIletthefileconsumerusetheCamelerrorhandler-HowtouseCamelsroutingerrorhandlerswiththefileconsumer]] == How to use Camel's routing error handlers with the file consumer
