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()); }
@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 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 void doLogVerbose(String message) { lastVerboseLogActivity = message; lastVerboseLogActivityTimestamp = System.currentTimeMillis(); if (endpoint.isTransferLoggingVerbose()) { logger.log(message, endpoint.getTransferLoggingLevel()); } } }
public void process(Exchange exchange, Throwable exception) { if (getLogger().shouldLog()) { getLogger().log(formatter.format(exchange), exception); } LOGGER.warn("An unexpected exception while processing exchange " + exchange.getExchangeId() + " has occured: " + exception); publish(exchange); }
public void process(Exchange exchange, String message) { if (getLogger().shouldLog()) { getLogger().log(formatter.format(exchange) + message); } LOGGER.warn("An unexpected exception while processing exchange " + exchange.getExchangeId() + " has occured: " + message); publish(exchange); }
/** * 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; }
@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; } }
long delta = watch.taken(); if (delta > timeout) { CamelLogger.log(LOG, readLockLoggingLevel, "Cannot acquire read lock within " + timeout + " millis. Will skip the file: " + file);
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); } } }
long delta = watch.taken(); if (delta > timeout) { CamelLogger.log(LOG, readLockLoggingLevel, "Cannot acquire read lock within " + timeout + " millis. Will skip the file: " + file);
public boolean process(Exchange exchange, AsyncCallback callback) { if (getLogger().shouldLog()) { getLogger().log(formatter.format(exchange)); } publish(exchange); callback.done(true); return true; }
public boolean process(final Exchange exchange, AsyncCallback callback) { if (!isRunAllowed()) { if (exchange.getException() == null) { exchange.setException(new RejectedExecutionException()); } callback.done(true); return true; } Object body; try { body = getRequestBody(exchange); if (body == null) { noReplyLogger.log("No payload to send for exchange: " + exchange); callback.done(true); return true; } return processWithBody(exchange, body, new BodyReleaseCallback(callback, body)); } catch (Exception e) { exchange.setException(e); callback.done(true); return true; } }
private void sendResponse(MessageEvent messageEvent, 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: {}", messageEvent.getRemoteAddress()); } NettyHelper.close(messageEvent.getChannel()); } } 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, messageEvent.getRemoteAddress()); if (consumer.getConfiguration().isTcp()) { NettyHelper.writeBodyAsync(LOG, messageEvent.getChannel(), null, body, exchange, listener); } else { NettyHelper.writeBodyAsync(LOG, messageEvent.getChannel(), messageEvent.getRemoteAddress(), body, exchange, listener); } } }
body = getRequestBody(exchange); if (body == null) { noReplyLogger.log("No payload to send for exchange: " + exchange); callback.done(true); return true;