Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18916

camel-xslt-saxon: allow logger injection

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.18.4, 3.20.1
    • 4.0-RC2, 4.0.0
    • camel-xslt
    • None
    • Unknown

    Description

      Currently, when we use camel-xslt-saxon in combination with <xsl:message ... />, the message will be written directly to System.out. This is not desired when the application, for example, uses json logging. It would be nice to have the capability to inject a logger-instance (e.g. org.slf4j.Logger or org.apache.logging.log4j.Logger) and redirect the log-output to that logger-instance.

      Reproducer:

      • checkout https://github.com/turing85/quarkus-camel-xslt-logging.git
      • run the test: ./mvnw clean test
      • observe that the message produced by <xsl:message select = "'Creating response for name = ', $name"/> in src/main/resources/Transformer.xsl is logged unformatted:
        ...
        2023-01-13 15:18:24,324 INFO [org.apa.cam.con.jax.StaxConverter] (executor-thread-0) Created XMLInputFactory: com.sun.xml.internal.stream.XMLInputFactoryImpl@38874bd. DOMSource/DOMResult may have issues with com.sun.xml.internal.stream.XMLInputFactoryImpl@38874bd. We suggest using Woodstox.
        Creating response for name = John Doe
        [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.232 s - in de.turing85.quarkus.camel.xslt.RouteTest
        ...

      Current Behaviour:

      Log message is directly written to System.out and therefore not formatted.


      Desired behaviour:

      The message is delegated to the logger-instance, and is therefore formatted by the logger-instance.

      Environment:

      • Java compiler used: openjdk 19.0.1 2022-10-18
      • Quarkus version: 2.15.3
      • Quarkus-camel version: 2.15.3
      • Camel version: 3.19.0

      Attachments

        Issue Links

          Activity

            People

              ammachado Adriano Machado
              turing85 Marco Bungart
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: