Another problem I have is to reconfigure my tracer "on the fly". I was hoping to use an OSGi configuration to configure my tracer.
My tracer presently extends org.apache.camel.processor.interceptor.Tracer but allow me to configure the tracer; e g whether or not the body should be included in the trace or not. I do that as follows: DefaultTraceFormatter formatter = new DefaultTraceFormatter(); formatter.setShowBody(mIncludeBody); setFormatter(formatter); The "mIncludeBody" is taken from an OSGi configuration parameter. I do the above once in the constructor. That works and my configuration parameter determines whether the body is included or not. However, when I later change my configuration, the new value does not seem to take effect. I can see that the above code is run (with the correct configuration parameter) but the behavior of the tracer doesn't change accordingly. Is it possible to change the formatter of a tracer after it has been constructed? /Bengt 2010/10/30 Bengt Rodehav <be...@rodehav.com> > I have a similar situation but I'm not using Spring - I use Java DSL and > iPOJO. > > I have my own tracer that I can publish as an OSGi service using iPOJO. I > want to accomplish the following. My other services shall have optional > service dependencies to my tracer. This means that if my custom tracer is > available then it should be used, otherwise the default tracer should be > used. > > However, just publishing my tracer and requiring it in my other components > does not automatically cause Camel to use it. I have to to the following: > > getContext().addInterceptStrategy(mTracer); > > getContext().setTracing(false); > > > In other words I explicitly set my tracer to be used, I then disable > tracing since the first line seems to automatically enable tracing. I then > use JMX to enable/disable tracing. I was hoping the above two lines were > unnecessary and that merely the existence of a tracer should cause Camel to > use it. Is that a Spring specific functionality? I was hoping that any way > that an OSGi service was published/consumed would work? > > /Bengt > > 2010/10/30 Richard Kettelerij <richardkettele...@gmail.com> > > >> You don't have to add a Tracer to your Spring context yourself. Camel adds >> one automatically if you have a CamelContext declared in Spring. Also your >> don't have to do anything with the "trace" option in your Spring context. >> >> I find that the easiest way to enable/disable tracing in production is >> through JMX. Just navigate to the CamelContext MBean and modify the >> "tracing" attribute. Additionally you can determine what should be traced >> by >> modifying a few options in the Tracer MBean. >> >> ----- >> Richard Kettelerij, >> http://github.com/rkettelerij >> -- >> View this message in context: >> http://camel.465427.n5.nabble.com/Enabling-tracing-in-production-tp3243013p3243143.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> > >