use of org.apache.camel.util.CamelLogger in project camel by apache.
the class DataSetEndpoint method createReporter.
protected ThroughputLogger createReporter() {
// must sanitize uri to avoid logging sensitive information
String uri = URISupport.sanitizeUri(getEndpointUri());
CamelLogger logger = new CamelLogger(uri);
ThroughputLogger answer = new ThroughputLogger(logger, (int) this.getDataSet().getReportCount());
answer.setAction("Received");
return answer;
}
use of org.apache.camel.util.CamelLogger in project camel by apache.
the class ThroughPutLoggerTest method testLogStringDurationIsNotZero.
public void testLogStringDurationIsNotZero() throws Exception {
CamelContext camel = new DefaultCamelContext();
camel.start();
Logger logger = EasyMock.createMock(Logger.class);
logger.isInfoEnabled();
EasyMock.expectLastCall().andReturn(true).atLeastOnce();
logger.info(EasyMock.startsWith("Received: 10"));
EasyMock.expectLastCall().once();
logger.info(EasyMock.startsWith("Received: 20"));
EasyMock.expectLastCall().once();
EasyMock.replay(logger);
ThroughputLogger underTest = new ThroughputLogger(new CamelLogger(logger));
underTest.setGroupSize(10);
for (int i = 0; i < 25; i++) {
underTest.process(new DefaultExchange(camel));
}
EasyMock.verify(logger);
camel.stop();
}
use of org.apache.camel.util.CamelLogger in project camel by apache.
the class LoggingErrorHandlerBuilder method createErrorHandler.
public Processor createErrorHandler(final RouteContext routeContext, final Processor processor) {
CamelLogger logger = new CamelLogger(log, level);
// configure policy to use the selected logging level, and only log exhausted
RedeliveryPolicy policy = new RedeliveryPolicy();
policy.setLogExhausted(true);
policy.setRetriesExhaustedLogLevel(level);
policy.setLogStackTrace(true);
policy.setLogRetryAttempted(false);
policy.setRetryAttemptedLogLevel(LoggingLevel.OFF);
policy.setLogRetryStackTrace(false);
policy.setLogContinued(false);
policy.setLogHandled(false);
LoggingErrorHandler handler = new LoggingErrorHandler(routeContext.getCamelContext(), processor, logger, policy, getExceptionPolicyStrategy());
configure(routeContext, handler);
return handler;
}
Aggregations