protected CamelLogger createLogger() { return new CamelLogger(LoggerFactory.getLogger(TransactionErrorHandler.class), LoggingLevel.ERROR); }
/** * Authenticates the http basic auth subject. * * @param authenticator the authenticator * @param principal the principal * @return <tt>true</tt> if username and password is valid, <tt>false</tt> if not */ protected Subject authenticate(SecurityAuthenticator authenticator, LoggingLevel deniedLoggingLevel, HttpPrincipal principal) { try { return authenticator.login(principal); } catch (LoginException e) { CamelLogger logger = new CamelLogger(LOG, deniedLoggingLevel); logger.log("Cannot login " + principal.getName() + " due " + e.getMessage(), e); } return null; }
protected void doLog(String message) { lastLogActivity = message; lastLogActivityTimestamp = System.currentTimeMillis(); // verbose implies regular log as well lastVerboseLogActivity = lastLogActivity; lastVerboseLogActivityTimestamp = lastLogActivityTimestamp; logger.log(message, endpoint.getTransferLoggingLevel()); }
@SuppressWarnings("PMD.SystemPrintln") @Override public String onLog(Exchange exchange, CamelLogger camelLogger, String message) { System.out.println(toJsonObject( "exchange", exchange.getExchangeId(), "step", camelLogger.getMarker().getName(), "id", KeyGenerator.createKey(), "message", message)); return message; } }
@Override public void handleException(String message, Exchange exchange, Throwable exception) { try { String msg = CamelExchangeException.createExceptionMessage(message, exchange, exception); boolean closed = ObjectHelper.getException(ClosedChannelException.class, exception) != null; if (closed) { logger.log(msg, exception, closedLoggingLevel); } else { logger.log(msg, exception); } } catch (Throwable e) { // the logging exception handler must not cause new exceptions to occur } }
@Override public String onLog(Exchange exchange, CamelLogger camelLogger, String message) { if (tracker == null) { return message; } final String activityId = exchange.getProperty(IntegrationLoggingConstants.ACTIVITY_ID, String.class); if (activityId != null) { final Marker marker = camelLogger.getMarker(); final String step = marker != null ? marker.getName() : "null"; final Message in = exchange.getIn(); String stepTrackerId = in.getHeader(IntegrationLoggingConstants.STEP_TRACKER_ID, String.class); if( stepTrackerId == null ) { stepTrackerId = KeyGenerator.createKey(); } tracker.track( "exchange", activityId, "step", step, "id", stepTrackerId, "message", message ); } return message; } }
public DefaultFtpClientActivityListener(FtpEndpoint endpoint, String host) { this.logger = new CamelLogger(LOG); this.endpoint = endpoint; this.host = host; }
@Override public void handleException(String message, Exchange exchange, Throwable exception) { try { String msg = CamelExchangeException.createExceptionMessage(message, exchange, exception); boolean closed = ObjectHelper.getException(ClosedChannelException.class, exception) != null; if (closed) { logger.log(msg, exception, closedLoggingLevel); } else { logger.log(msg, exception); } } catch (Throwable e) { // the logging exception handler must not cause new exceptions to occur } }
protected CamelLogger createLogger() { return new CamelLogger(LoggerFactory.getLogger(TransactionErrorHandler.class), LoggingLevel.ERROR); }
protected void doLogVerbose(String message) { lastVerboseLogActivity = message; lastVerboseLogActivityTimestamp = System.currentTimeMillis(); if (endpoint.isTransferLoggingVerbose()) { logger.log(message, endpoint.getTransferLoggingLevel()); } } }
@PostConstruct public void init() { setLogName(BisTracer.class.getName()); bisTraceProcessor = new BisTraceProcessor(tracePublisher, new CamelLogger(getLogName(), getLogLevel())); LOGGER.info("BIS Tracer is enabled and successfully configured."); }
@Override public boolean onEviction(String key, NettyCamelState value) { timeoutLogger.log("Timeout of correlation id: " + key); workerPool.submit(() -> { Exchange exchange = value.getExchange(); AsyncCallback callback = value.getCallback(); if (exchange != null && callback != null) { Object timeoutBody = getTimeoutResponse(key, exchange.getMessage().getBody()); if (timeoutBody != null) { exchange.getMessage().setBody(timeoutBody); } else { exchange.setException(new ExchangeTimedOutException(exchange, timeout)); } callback.done(false); } }); return true; } }
public ServerChannelHandler(NettyConsumer consumer) { this.consumer = consumer; this.noReplyLogger = new CamelLogger(LOG, consumer.getConfiguration().getNoReplyLogLevel()); }
long delta = watch.taken(); if (delta > timeout) { CamelLogger.log(LOG, readLockLoggingLevel, "Cannot acquire read lock within " + timeout + " millis. Will skip the file: " + file);
public ServerChannelHandler(NettyConsumer consumer) { this.consumer = consumer; this.noReplyLogger = new CamelLogger(LOG, consumer.getConfiguration().getNoReplyLogLevel()); }
private void sendResponse(Object message, ChannelHandlerContext ctx, Exchange exchange) throws Exception { Object body = getResponseBody(exchange); if (body == null) { noReplyLogger.log("No payload to send as reply for exchange: " + exchange); if (consumer.getConfiguration().isDisconnectOnNoReply()) { // must close session if no data to write otherwise client will never receive a response // and wait forever (if not timing out) if (LOG.isTraceEnabled()) { LOG.trace("Closing channel as no payload to send as reply at address: {}", ctx.channel().remoteAddress()); } NettyHelper.close(ctx.channel()); } } else { // if textline enabled then covert to a String which must be used for textline if (consumer.getConfiguration().isTextline()) { body = NettyHelper.getTextlineBody(body, exchange, consumer.getConfiguration().getDelimiter(), consumer.getConfiguration().isAutoAppendDelimiter()); } // we got a body to write ChannelFutureListener listener = createResponseFutureListener(consumer, exchange, ctx.channel().remoteAddress()); if (consumer.getConfiguration().isTcp()) { NettyHelper.writeBodyAsync(LOG, ctx.channel(), null, body, exchange, listener); } else { NettyHelper.writeBodyAsync(LOG, ctx.channel(), exchange.getProperty(NettyConstants.NETTY_REMOTE_ADDRESS, SocketAddress.class), body, exchange, listener); } } }
public NettyProducer(NettyEndpoint nettyEndpoint, NettyConfiguration configuration) { super(nettyEndpoint); this.configuration = configuration; this.context = this.getEndpoint().getCamelContext(); this.noReplyLogger = new CamelLogger(LOG, configuration.getNoReplyLogLevel()); }