use of org.slf4j.Marker in project logging-log4j2 by apache.
the class Log4jMarker method add.
@Override
public void add(final Marker marker) {
if (marker == null) {
throw new IllegalArgumentException();
}
final Marker m = factory.getMarker(marker.getName());
this.marker.addParents(((Log4jMarker) m).getLog4jMarker());
}
use of org.slf4j.Marker in project logging-log4j2 by apache.
the class Log4jMarkerFactory method addMarkerIfAbsent.
private Marker addMarkerIfAbsent(final String name, final org.apache.logging.log4j.Marker log4jMarker) {
final Marker marker = new Log4jMarker(log4jMarker);
final Marker existing = markerMap.putIfAbsent(name, marker);
return existing == null ? marker : existing;
}
use of org.slf4j.Marker in project logging-log4j2 by apache.
the class Log4jMarkerFactory method getMarker.
/**
* Returns a Log4j Marker that is compatible with SLF4J.
* @param name The name of the Marker.
* @return A Marker.
*/
@Override
public Marker getMarker(final String name) {
if (name == null) {
throw new IllegalArgumentException("Marker name must not be null");
}
final Marker marker = markerMap.get(name);
if (marker != null) {
return marker;
}
final org.apache.logging.log4j.Marker log4jMarker = MarkerManager.getMarker(name);
return addMarkerIfAbsent(name, log4jMarker);
}
use of org.slf4j.Marker in project cassandra-mesos-deprecated by mesosphere.
the class CassandraScheduler method executorLost.
@Override
public void executorLost(final SchedulerDriver driver, final ExecutorID executorId, final SlaveID slaveId, final int status) {
final Marker executorIdMarker = MarkerFactory.getMarker("executorId:" + executorId.getValue());
// https://issues.apache.org/jira/browse/MESOS-313
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(executorIdMarker, "executorLost(driver : {}, executorId : {}, slaveId : {}, status : {})", driver, protoToString(executorId), protoToString(slaveId), protoToString(status));
}
cassandraCluster.removeExecutor(executorId.getValue());
}
use of org.slf4j.Marker in project cassandra-mesos-deprecated by mesosphere.
the class CassandraScheduler method statusUpdate.
@Override
public void statusUpdate(final SchedulerDriver driver, final TaskStatus status) {
final Marker taskIdMarker = MarkerFactory.getMarker("taskId:" + status.getTaskId().getValue());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(taskIdMarker, "> statusUpdate(driver : {}, status : {})", driver, protoToString(status));
}
try {
final ExecutorID executorId = status.getExecutorId();
final TaskID taskId = status.getTaskId();
final SlaveStatusDetails statusDetails;
if (!status.getData().isEmpty()) {
statusDetails = SlaveStatusDetails.parseFrom(status.getData());
} else {
statusDetails = SlaveStatusDetails.getDefaultInstance();
}
switch(status.getState()) {
case TASK_STAGING:
// TODO really interested in staging state?
break;
case TASK_STARTING:
// TODO really interested in starting state?
break;
case TASK_RUNNING:
switch(statusDetails.getStatusDetailsType()) {
case NULL_DETAILS:
break;
case EXECUTOR_METADATA:
final ExecutorMetadata executorMetadata = statusDetails.getExecutorMetadata();
cassandraCluster.addExecutorMetadata(executorMetadata);
break;
case CASSANDRA_SERVER_RUN:
cassandraCluster.updateCassandraProcess(executorId, statusDetails.getCassandraServerRunMetadata());
break;
case HEALTH_CHECK_DETAILS:
break;
case ERROR_DETAILS:
break;
}
break;
case TASK_FAILED:
case TASK_KILLED:
case TASK_LOST:
case TASK_ERROR:
LOGGER.error(taskIdMarker, "Got status {} for task {}, executor {} ({}, healthy={}): {}", status.getState(), status.getTaskId().getValue(), status.getExecutorId().getValue(), protoToString(status.getReason()), status.getHealthy(), status.getMessage());
case TASK_FINISHED:
if (status.getSource() == TaskStatus.Source.SOURCE_SLAVE && status.getReason() == TaskStatus.Reason.REASON_EXECUTOR_TERMINATED) {
// this code should really be handled by executorLost, but it can't due to the fact that
// executorLost will never be called.
// there is the possibility that the executorId we get in the task status is empty,
// so here we use the taskId to lookup the executorId based on the tasks we're tracking
// to try and have a more accurate value.
final Optional<String> opt = cassandraCluster.getExecutorIdForTask(taskId.getValue());
final ExecutorID executorIdForTask;
if (opt.isPresent()) {
executorIdForTask = executorId(opt.get());
} else {
executorIdForTask = executorId;
}
executorLost(driver, executorIdForTask, status.getSlaveId(), status.getState().ordinal());
} else {
switch(statusDetails.getStatusDetailsType()) {
case NULL_DETAILS:
break;
case EXECUTOR_METADATA:
break;
case ERROR_DETAILS:
LOGGER.error(taskIdMarker, protoToString(statusDetails.getSlaveErrorDetails()));
break;
case HEALTH_CHECK_DETAILS:
cassandraCluster.recordHealthCheck(executorId.getValue(), statusDetails.getHealthCheckDetails());
break;
case NODE_JOB_STATUS:
cassandraCluster.onNodeJobStatus(statusDetails);
break;
}
cassandraCluster.removeTask(taskId.getValue(), status);
}
break;
}
} catch (final InvalidProtocolBufferException e) {
final String msg = "Error deserializing task status data to type: " + SlaveStatusDetails.class.getName();
LOGGER.error(msg, e);
}
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(taskIdMarker, "< statusUpdate(driver : {}, status : {})", driver, protoToString(status));
}
}
Aggregations