camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: Tracer Logging never turned on?
Date Fri, 26 Aug 2011 02:25:43 GMT
Hi,

You can not simply enable the trace by setting the tracing option.
You need to override the createCamelContext like this.

     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext context = super.createCamelContext();

         tracer = Tracer.createTracer(context);
         tracer.setEnabled(true);
         tracer.setTraceInterceptors(true);
         tracer.setTraceFilter(body().contains("Camel"));
         tracer.setTraceExceptions(true);
         tracer.setLogStackTrace(true);
         tracer.setUseJpa(false);
         tracer.setDestination(context.getEndpoint("mock:traced"));

         context.addInterceptStrategy(tracer);
         tracer.start();

         return context;
     }
You can find more information about tracer here[1]
[1]http://camel.apache.org/tracer.html

On 8/26/11 2:27 AM, roy.truelove wrote:
> Camel 2.9
>
> I wrote a very simple junit test (below) with the tracer turned on, but I
> didn't seem to get any tracing messages, so I fired up the debugger.
>
> It looks like when the tracer tries to log, it has have it's log level set.
> Initially this is done by the DefaultDebugger class, which sets it to 'OFF'
> (line 334).
>
> I put a break point on the other places where the tracer's 'setLogLevel'
> method is called, and it never is.  I'd expect it to be set to 'INFO' when I
> call 'context.setTracing(true)'.
>
> Where is the tracer intended to set the log level to INFO?
>
> Thanks,
> Roy
>
> public class TracerTest extends CamelTestSupport {
>
> 	@Override
> 	protected RouteBuilder createRouteBuilder() {
> 		return new RouteBuilder() {
>
> 			@Override
> 			public void configure() throws Exception {
> 				from("direct:in").to("mock:out");
> 			}
> 		};
> 	}
>
> 	@Test
> 	public void testName() throws Exception {
>
> 		context.setTracing(true);
> 		template.sendBody("direct:in", "Hello!");
>
> 		Thread.sleep(1000000);  // so the debug can do it's thing
> 	}
> }
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Tracer-Logging-never-turned-on-tp4735516p4735516.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Mime
View raw message