private Marker getRemoteMethod() { return append("method", client.getServiceMethodName()); }
public Marker getLoggingMarker() { // If we get more optional header fields, we should probably exclude them if they are empty. Marker messageMarker = append("messageId", messageId) .and(append("partitionId", partitionId)) .and(append("partitioningKey", partitioningKey)) .and(append("offset", offset)) .and(append("messageId", messageId)) .and(append("correlationId", correlationId)) .and(append("requestCorrelationId", requestCorrelationId)); // Nota bene: without the toString the marker tries to convert the object into Json, which produces strange results if (topic != null) { messageMarker.add(append("topic", topic.toString())); } if (replyTo != null) { messageMarker.add(append("replyTo", replyTo.toString())); } if (type != null) { messageMarker.add(append("messageType", type.toString())); } return messageMarker; }
private Marker logMarkerFromRecordAndEnvelope(Envelope envelope) { LogstashMarker logMarker = append("topic", record.topic()) .and(append("partitionId", record.partition())) .and(append("distributionKey", record.key())) .and(append("offset", record.offset())); if (envelope != null) { logMarker .and(append("messageId", envelope.getMessageId())) .and(append("correlationId", envelope.getCorrelationId())) .and(append("messageType", envelope.getMessageType())); } return logMarker; } }
@SuppressWarnings(value = "unchecked") protected void readMessages() { logger.trace("Reading messages from Kafka..."); checkForMessageThrottling(); ConsumerRecords<String, String> records = realConsumer.poll(pollTime); if (records != null) { messagesReadMetric.incSuccess(records.count()); for (ConsumerRecord<String, String> record : records) { String rawMessage = record.value(); logger.trace(append("rawMessage", rawMessage), "Read Kafka message ({}/{})", record.partition(), record.offset()); messageQueue.add(record); } } }
public static RpcCallException fromJson(String json) { Marker marker = Markers.append("payload", json);
@Override public void updateServiceEndpoints(LoadBalancerUpdate updates) { mutex.writeLock().lock(); try { Marker logMarker = append("serviceName", this.serviceName); for (ServiceEndpoint ep : updates.getNewServices()) { logger.debug(logMarker, "Endpoint for {} became available: {}", this.serviceName, ep.getHostAndPort()); addServiceEndpoint(ep); } for (ServiceEndpoint ep : updates.getDeletedServices()) { logger.debug(logMarker, "Endpoint for {} became unavailable: {}", this.serviceName, ep.getHostAndPort()); updateEndpointHealth(ep, CircuitBreakerState.State.UNHEALTHY); } for (ServiceEndpoint ep : updates.getUpdatedServices()) { logger.debug(logMarker, "Health of endpoint {} of {} changed to {}", ep.getHostAndPort(), this.serviceName, ep.getCircuitBreakerState()); updateEndpointHealth(ep, ep.getCircuitBreakerState()); } } finally { mutex.writeLock().unlock(); } }
public void logOutboundSoapMessage(String outboundSoapMessage) { delegateLogger.info(append(ElasticsearchField.SOAP_MESSAGE_OUTBOUND.getName(), outboundSoapMessage), "<]=== Outbound-SoapMessage <]==="); }
public void logInboundSoapMessage(String inboundSoapMessage) { delegateLogger.info(append(ElasticsearchField.SOAP_MESSAGE_INBOUND.getName(), inboundSoapMessage), "===[> Inbound-SoapMessage ===[>"); }
@Override protected String formatLoggingMessage(LoggingMessage loggingMessage) { // Only write the Payload (SOAP-Xml) to Logger if (loggingMessage.getPayload().length() > 0) { LOG.info(append(SOAP_MESSAGE_OUTBOUND, loggingMessage.getPayload().toString()), "Log Outbound-SoapMessage to Elasticseach"); } // This is just hook into CXF and get the SOAP-Message. // The returned String will never be logged somewhere. return ""; } }
@Override protected String formatLoggingMessage(LoggingMessage loggingMessage) { // Only write the Payload (SOAP-Xml) to Logger if (loggingMessage.getPayload().length() > 0) { LOG.info(append(SOAP_MESSAGE_INBOUND, loggingMessage.getPayload().toString()), "Log Inbound-SoapMessage to Elasticseach"); } // This is just hook into CXF and get the SOAP-Message. // The returned String will never be logged somewhere. return ""; }
public void logHttpHeader(String headers) { delegateLogger.info(append(ElasticsearchField.HTTP_HEADER_INBOUND.getName(), headers), "001 >>> Header in Inbound-HTTP-Message see Elasticsearch-Field '{}'", ElasticsearchField.HTTP_HEADER_INBOUND.getName()); }
private void log2Elasticsearch(ElasticsearchField elasticsearchField, String elasticsearchFieldValue, String logTemplate) { delegateLogger.info(append(elasticsearchField.getName(), elasticsearchFieldValue), logTemplate, elasticsearchField.getName()); }
private void prepareLog(Integer statusCode) throws JsonProcessingException { if (printAllTrace) { if (isInfo(statusCode)) { log.info(" [HEIMDALL-TRACE] - {} ", new ObjectMapper().writeValueAsString(this)); } else if (isWarn(statusCode)) { log.warn(" [HEIMDALL-TRACE] - {} ", new ObjectMapper().writeValueAsString(this)); } else { log.error(" [HEIMDALL-TRACE] - {} ", new ObjectMapper().writeValueAsString(this)); } } else { String url = (Objeto.notBlank(getUrl())) ? getUrl() : ""; if (isInfo(statusCode)) { log.info(append("call", this), " [HEIMDALL-TRACE] - " + url); if (printMongo) logMongo.info(new ObjectMapper().writeValueAsString(this)); } else if (isWarn(statusCode)) { log.warn(append("call", this), " [HEIMDALL-TRACE] - " + url); if (printMongo) logMongo.warn(new ObjectMapper().writeValueAsString(this)); } else { log.error(append("call", this), " [HEIMDALL-TRACE] - " + url); if (printMongo) logMongo.error(new ObjectMapper().writeValueAsString(this)); } } }