@Override protected void doStart() throws Exception { super.doStart(); Properties props = new Properties(); props.put("org.ops4j.pax.logging.appender.name", endpoint.getName()); registration = endpoint .getComponent() .getBundleContext() .registerService(PaxAppender.class.getName(), this, props); executor = Executors.newSingleThreadExecutor(); }
protected void sendExchange(PaxLoggingEvent paxLoggingEvent) { MDC.put(PaxLoggingConsumer.class.getName(), endpoint.getName()); if (paxLoggingEvent.getProperties().containsKey(PaxLoggingConsumer.class.getName())) { return; } Exchange exchange = endpoint.createExchange(); // TODO: populate exchange headers exchange.getIn().setBody(paxLoggingEvent); LOG.trace("PaxLogging {} is firing", endpoint.getName()); try { getProcessor().process(exchange); // log exception if an exception occurred and was not handled if (exchange.getException() != null) { getExceptionHandler() .handleException("Error processing exchange", exchange, exchange.getException()); } } catch (Exception e) { getExceptionHandler() .handleException("Error processing exchange", exchange, exchange.getException()); } }