Search in sources :

Example 1 with Marker

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());
}
Also used : Marker(org.slf4j.Marker)

Example 2 with Marker

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;
}
Also used : Marker(org.slf4j.Marker)

Example 3 with Marker

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);
}
Also used : Marker(org.slf4j.Marker)

Example 4 with Marker

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());
}
Also used : Marker(org.slf4j.Marker)

Example 5 with Marker

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));
    }
}
Also used : InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) Marker(org.slf4j.Marker) ByteString(com.google.protobuf.ByteString)

Aggregations

Marker (org.slf4j.Marker)12 ByteString (com.google.protobuf.ByteString)2 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)2 Test (org.junit.Test)2 Trace (com.evolveum.midpoint.util.logging.Trace)1 CassandraFrameworkProtos (io.mesosphere.mesos.frameworks.cassandra.CassandraFrameworkProtos)1 ProtoUtils.protoToString (io.mesosphere.mesos.util.ProtoUtils.protoToString)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 FilenameFilter (java.io.FilenameFilter)1 Scanner (java.util.Scanner)1 Protos (org.apache.mesos.Protos)1