2 Replies Latest reply on Dec 20, 2011 10:21 AM by jamie3_james.archibald

    Setting log name for all routes in a RouteBuilder

    jamie3_james.archibald

      I have a route as follows

       

      public class MyRoute extends RouteBuilder {

       

         public void configure() {

            from(...)

            .log(LoggingLevel.INFO, "Test", MyRoute.class.getName())

            .to(...)

            .log(LoggingLevel.DEBUG, "Test", MyRoute.class.getName())

            .log(LoggingLevel.DEBUG, "Test", MyRoute.class.getName())

            .log(LoggingLevel.DEBUG, "Test", MyRoute.class.getName())

         }

      }

       

      Rather than repeating the configuration of each log pattern individually, is there a way I can simply set the RouteBuilder to always use the log name for an entire route? For example:

       

      public void configure() {

            from(...)

            .logName(MyRoute.class.getName())

            .logLevel(LoggingLevel.DEBUG)

            .log("Test")

            .to(...)

            .logLevel(LoggingLevel.INFO)

            .log("Test")

            .log("Test")

            .log("Test")

         }

       

      The above code is much better syntax than having to repeat the LoggingLevel and log name for each log() pattern.

       

      If this doesn't exist can I submit a feature request?

       

      thanks again!