public LogComponent() {
super(LogEndpoint.class);
}
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
LoggingLevel level = getLoggingLevel(parameters);
Logger providedLogger = getLogger(parameters);
if (providedLogger == null) {
// try to look up the logger in registry
Map<String, Logger> availableLoggers = getCamelContext().getRegistry().findByTypeWithName(Logger.class);
if (availableLoggers.size() == 1) {
providedLogger = availableLoggers.values().iterator().next();
LOG.info("Using custom Logger: {}", providedLogger);
} else if (availableLoggers.size() > 1) {
LOG.info("More than one {} instance found in the registry. Falling back to creating logger from URI {}.", Logger.class.getName(), uri);
}
}
LogEndpoint endpoint = new LogEndpoint(uri, this);
endpoint.setLevel(level.name());
setProperties(endpoint, parameters);
CamelLogger camelLogger = null;
if (providedLogger == null) {
camelLogger = new CamelLogger(remaining, level, endpoint.getMarker());