当前位置: 首页>>代码示例>>Java>>正文


Java LoggingLevel类代码示例

本文整理汇总了Java中org.apache.camel.LoggingLevel的典型用法代码示例。如果您正苦于以下问题:Java LoggingLevel类的具体用法?Java LoggingLevel怎么用?Java LoggingLevel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LoggingLevel类属于org.apache.camel包,在下文中一共展示了LoggingLevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRouteBuilder

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            errorHandler(deadLetterChannel("mock:global")
                .maximumRedeliveries(2)
                .redeliveryDelay(5000));

            from("direct:start")
                // no redelivery delay for faster unit tests
                .onException(ConnectException.class).maximumRedeliveries(5).redeliveryDelay(0)
                    .logRetryAttempted(true).retryAttemptedLogLevel(LoggingLevel.WARN)
                    // send to mock when we are exhausted
                    .to("mock:exhausted")
                .end()
                .to("seda:foo");
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:RouteScopedOnExceptionWithInterceptSendToEndpointIssueTest.java

示例2: configure

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
public void configure() throws Exception {
    // no problems
    from("flowable:ErrorHandling:NormalExecution").routeId("outbound").log(LoggingLevel.INFO, "Normal execution").to("seda:inbound");

    // always fails with default error handling: propagates exception back
    // to the caller
    from("flowable:ErrorHandling:ProvokeError").routeId("error").log(LoggingLevel.INFO, "Provoked error").bean("brokenService") // <--
                                                                                                                                // throws
                                                                                                                                // Exception
            .to("seda:inbound");

    // always fails with specific error handler: exception is not propagated
    // back
    from("flowable:ErrorHandling:HandleError").routeId("errorWithDlq").errorHandler(deadLetterChannel("seda:dlq")).log(LoggingLevel.INFO, "Provoked error").bean("brokenService") // <--
                                                                                                                                                                                  // throws
                                                                                                                                                                                  // Exception
            .to("seda:inbound");
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:20,代码来源:OutboundErrorRoute.java

示例3: configure

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
public void configure() {

            Tracer tracer = new Tracer();
            tracer.setLogLevel(LoggingLevel.ERROR);
            tracer.setLogName("org.apache.camel.bindy");
            tracer.setLogStackTrace(true);
            tracer.setTraceExceptions(true);

            getContext().addInterceptStrategy(tracer);

            // default should errors go to mock:error
            errorHandler(deadLetterChannel(URI_MOCK_ERROR));

            onException(IllegalArgumentException.class).maximumRedeliveries(0).handled(true);

            from(URI_DIRECT_START).marshal(orderBindyDataFormat).to(URI_MOCK_RESULT);
        }
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:BindySimpleKeyValuePairWithoutSectionMarshallDslTest.java

示例4: createRouteBuilder

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // START SNIPPET: e1

            // this error handler will try up till 20 redelivery attempts with 1 second between.
            // however if we are stopping then do not allow any redeliver attempts.
            errorHandler(defaultErrorHandler()
                    .allowRedeliveryWhileStopping(false)
                    .maximumRedeliveries(20).redeliveryDelay(1000).retryAttemptedLogLevel(LoggingLevel.INFO));

            from("seda:foo").routeId("foo")
                .to("mock:foo")
                .throwException(new IllegalArgumentException("Forced"));
            // END SNIPPET: e1
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:RedeliveryErrorHandlerNoRedeliveryOnShutdownTest.java

示例5: createRouteBuilder

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            onException(Exception.class)
                    .maximumRedeliveries(REDELIVERY_COUNT)
                    .retryAttemptedLogLevel(LoggingLevel.INFO)
                    .retriesExhaustedLogLevel(LoggingLevel.ERROR)
                    // lets have a little delay so we do async redelivery
                    .redeliveryDelay(10)
                    .to("mock:exception")
                    .handled(true);

            from("direct:start")
                    .routeId("start")
                    .to("netty4:tcp://localhost:" + port)
                    .to("log:downstream")
                    .to("mock:downstream");
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:NettyRedeliveryTest.java

示例6: testConsumptionCompletionSize

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Test
public void testConsumptionCompletionSize() throws Exception {
    final int completionSize = 5;
    final int completionTimeout = -1; // size-based only

    final String queueName = getQueueName();
    context.addRoutes(new TransactedSendHarness(queueName));
    context.addRoutes(new RouteBuilder() {
        public void configure() throws Exception {
            fromF("sjms-batch:%s?completionTimeout=%s&completionSize=%s&aggregationStrategy=#testStrategy",
                    queueName, completionTimeout, completionSize).routeId("batchConsumer").startupOrder(10)
                    .log(LoggingLevel.DEBUG, "${body.size}")
                    .to("mock:batches");
        }
    });
    context.start();

    int messageCount = 100;
    MockEndpoint mockBatches = getMockEndpoint("mock:batches");
    mockBatches.expectedMessageCount(messageCount / completionSize);

    template.sendBody("direct:in", generateStrings(messageCount));
    mockBatches.assertIsSatisfied();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:25,代码来源:SjmsBatchConsumerTest.java

示例7: testLoggingErrorHandler5

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
public void testLoggingErrorHandler5() throws Exception {
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            errorHandler(loggingErrorHandler().level(LoggingLevel.ERROR).logName("foo"));

            from("direct:start").to("mock:foo").throwException(new IllegalArgumentException("Damn"));
        }
    });
    context.start();

    try {
        template.sendBody("direct:start", "Hello World");
        fail("Should have thrown an exception");
    } catch (Exception e) {
        // expected
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:LoggingErrorHandlerBuilderTest.java

示例8: configure

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
public void configure() {
    BindyCsvDataFormat camelDataFormat = 
        new BindyCsvDataFormat(org.apache.camel.dataformat.bindy.model.simple.oneclass.Order.class);
    camelDataFormat.setLocale("en");

    Tracer tracer = new Tracer();
    tracer.setLogLevel(LoggingLevel.ERROR);
    tracer.setLogName("org.apache.camel.bindy");

    getContext().addInterceptStrategy(tracer);

    // default should errors go to mock:error
    errorHandler(deadLetterChannel(URI_MOCK_ERROR).redeliveryDelay(0));

    onException(Exception.class).maximumRedeliveries(0).handled(true);

    from(URI_DIRECT_START).marshal(camelDataFormat).to(URI_MOCK_RESULT);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:BindyPojoSimpleCsvMarshallTest.java

示例9: createRouteBuilder

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() {
            getContext().addInterceptStrategy(new HandleFault());

            errorHandler(
                deadLetterChannel("mock:error")
                    .maximumRedeliveries(4)
                    .loggingLevel(LoggingLevel.DEBUG));

            from("direct:start")
                .to("mock:a")
                .process(successOnRetryProcessor)
                .to("mock:b");
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:FaultRetryRouteTest.java

示例10: createRouteBuilder

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            onException(IllegalArgumentException.class)
                .handled(true)
                .to("mock:handled");

            from("seda:a")
                .errorHandler(deadLetterChannel("mock:dead.a")
                        .maximumRedeliveries(3).redeliveryDelay(0)
                        .retryAttemptedLogLevel(LoggingLevel.WARN).asyncDelayedRedelivery())
                .to("mock:a")
                .throwException(new IllegalArgumentException("Forced A"));

            from("seda:b")
                    .errorHandler(deadLetterChannel("mock:dead.b")
                        .maximumRedeliveries(2).redeliveryDelay(0)
                        .retryAttemptedLogLevel(LoggingLevel.WARN))
                .to("mock:b")
                .throwException(new IOException("Some IO error"));
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:26,代码来源:MultipleErrorHandlerOnExceptionIssueTest.java

示例11: testLoggingErrorHandler2

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
public void testLoggingErrorHandler2() throws Exception {
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            errorHandler(loggingErrorHandler().level(LoggingLevel.WARN).log(LoggerFactory.getLogger("foo")));

            from("direct:start").to("mock:foo").throwException(new IllegalArgumentException("Damn"));
        }
    });
    context.start();

    try {
        template.sendBody("direct:start", "Hello World");
        fail("Should have thrown an exception");
    } catch (Exception e) {
        // expected
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:LoggingErrorHandlerBuilderTest.java

示例12: createRouteBuilder

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            Tracer tracer = new Tracer();
            tracer.setDestinationUri("mock:traced");
            tracer.setLogLevel(LoggingLevel.OFF);
            context.addInterceptStrategy(tracer);

            from("direct:start").to("log:foo").to("mock:result");

            from("direct:foo").noTracing().to("mock:foo");
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:ManagedRouteContextTracerTest.java

示例13: configure

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@SuppressWarnings("el-syntax")
@Override
public void configure() throws Exception {
	from("netty4-http:http://0.0.0.0:9090/produceJmsMessage")
		.routeId("jms-message-producer-route")
		.streamCaching()
		.setProperty("start", simple("${date:now:YYYYMMDD HH:mm:ss.SSS}"))
		.filter(header("destination").isNull())
			.transform().method("informationBean","transactedUsage()")
			.stop()
		.end()
		.process("jmsSendPropertiesProcessor") // Prepare JMS Send Properties
		.log(LoggingLevel.INFO, 
				"Publishing ${exchangeProperty.messageCount} messages...")
		.setExchangePattern(ExchangePattern.InOnly)
		.loopDoWhile(simple("${exchangeProperty.messageCount} > 0"))
			.process("jmsTransactionBatchProcessor") // Prepare Transaction Batch to send
			.log(LoggingLevel.INFO, 
					"Batch size: ${exchangeProperty.transactionBatchSize} - [${exchangeProperty.sjmsUri}]")
			.recipientList(exchangeProperty("sjmsUri")).end()
		.end()
		.setProperty("end", simple("${date:now:YYYYMMDD HH:mm:ss.SSS}"))
		.setProperty("duration").method("informationBean",
       				 "getDuration(${exchangeProperty.start},${exchangeProperty.end})")
		.log(LoggingLevel.INFO, 
				"Publishing ${exchangeProperty.messageToSend} messages DONE in ${exchangeProperty.duration}")
		.setExchangePattern(ExchangePattern.InOut)
		.process("prepareHttpResponseProcessor");
}
 
开发者ID:jeanNyil,项目名称:fis-amq-producer,代码行数:30,代码来源:JmsMessageProducerRoute.java

示例14: handle

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Override
public Optional<ProcessorDefinition> handle(Log step, ProcessorDefinition route, SyndesisRouteBuilder routeBuilder) {
    LoggingLevel loggingLevel = LoggingLevel.INFO;
    if (step.getLoggingLevel() != null) {
        loggingLevel = LoggingLevel.valueOf(step.getLoggingLevel());
    }

    return Optional.of(route.log(loggingLevel, step.getLogger(), step.getMarker(), step.getMessage()));
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:10,代码来源:LogHandler.java

示例15: route

import org.apache.camel.LoggingLevel; //导入依赖的package包/类
@Bean
@Override
public RouteBuilder route() {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            // @formatter:off
            from("direct:test").routeId("spongeProducer")
                    .to("sponge:spongeEngine")
                    .log("Sent event: ${body}");

            from("direct:log").routeId("directLog")
                    .log("${body}");

            from("direct:error").routeId("directError")
                    .log(LoggingLevel.ERROR, "Received message on direct:error endpoint.");

            from("direct:end").routeId("directEnd")
                    .log("Received message on direct:end endpoint: ${body}");

            from("sponge:spongeEngine").routeId("spongeConsumer")
                    .log("Received message on direct:consumerEnd endpoint: ${body}");
            // @formatter:on
        }
    };
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:28,代码来源:CamelMultipleConsumerTest.java


注:本文中的org.apache.camel.LoggingLevel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。