Search in sources :

Example 1 with ErrorStatus

use of ch.qos.logback.core.status.ErrorStatus in project rocketmq by apache.

the class RocketmqLogbackAppender method start.

/**
 * Options are activated and become effective only after calling this method.
 */
public void start() {
    int errors = 0;
    if (this.layout == null) {
        addStatus(new ErrorStatus("No layout set for the RocketmqLogbackAppender named \"" + name + "\".", this));
        errors++;
    }
    if (errors > 0 || !checkEntryConditions()) {
        return;
    }
    try {
        producer = ProducerInstance.getProducerInstance().getInstance(nameServerAddress, producerGroup);
    } catch (Exception e) {
        addError("Starting RocketmqLogbackAppender [" + this.getName() + "] nameServerAddress:" + nameServerAddress + " group:" + producerGroup + " " + e.getMessage());
    }
    if (producer != null) {
        super.start();
    }
}
Also used : ErrorStatus(ch.qos.logback.core.status.ErrorStatus)

Example 2 with ErrorStatus

use of ch.qos.logback.core.status.ErrorStatus in project rocketmq-externals by apache.

the class RocketmqLogbackAppender method start.

/**
 * Options are activated and become effective only after calling this method.
 */
public void start() {
    int errors = 0;
    if (this.layout == null) {
        addStatus(new ErrorStatus("No layout set for the RocketmqLogbackAppender named \"" + name + "\".", this));
        errors++;
    }
    if (errors > 0 || !checkEntryConditions()) {
        return;
    }
    try {
        producer = ProducerInstance.getProducerInstance().getInstance(nameServerAddress, producerGroup);
    } catch (Exception e) {
        addError("Starting RocketmqLogbackAppender [" + this.getName() + "] nameServerAddress:" + nameServerAddress + " group:" + producerGroup + " " + e.getMessage());
    }
    if (producer != null) {
        super.start();
    }
}
Also used : ErrorStatus(ch.qos.logback.core.status.ErrorStatus)

Example 3 with ErrorStatus

use of ch.qos.logback.core.status.ErrorStatus in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.

the class RocketmqLogbackAppender method start.

/**
 * Options are activated and become effective only after calling this method.
 */
public void start() {
    int errors = 0;
    if (this.layout == null) {
        addStatus(new ErrorStatus("No layout set for the RocketmqLogbackAppender named \"" + name + "\".", this));
        errors++;
    }
    if (errors > 0 || !checkEntryConditions()) {
        return;
    }
    try {
        producer = ProducerInstance.getInstance(nameServerAddress, producerGroup);
    } catch (Exception e) {
        addError("Starting RocketmqLogbackAppender [" + this.getName() + "] nameServerAddress:" + nameServerAddress + " group:" + producerGroup + " " + e.getMessage());
    }
    if (producer != null) {
        super.start();
    }
}
Also used : ErrorStatus(ch.qos.logback.core.status.ErrorStatus)

Example 4 with ErrorStatus

use of ch.qos.logback.core.status.ErrorStatus in project minijax by minijax.

the class CloudWatchAppender method start.

@Override
public synchronized void start() {
    if (isStarted()) {
        return;
    }
    if (layout == null) {
        layout = new EchoLayout<>();
        addStatus(new WarnStatus("No layout, default to " + layout, this));
    }
    if (logGroupName == null) {
        logGroupName = getClass().getSimpleName();
        addStatus(new WarnStatus("No logGroupName, default to " + logGroupName, this));
    }
    if (logStreamName == null) {
        logStreamName = new SimpleDateFormat("yyyyMMdd'T'HHmmss").format(new Date());
        addStatus(new WarnStatus("No logGroupName, default to " + logStreamName, this));
    }
    try {
        if (awsLogs == null) {
            awsLogs = AWSLogsClientBuilder.defaultClient();
        }
        createLogGroup();
        createLogStream();
    } catch (final AmazonClientException e) {
        awsLogs = null;
        addStatus(new ErrorStatus(e.getMessage(), this, e));
    }
    // Start a new daemon time thread to periodically upload events
    // Because this is a deamon thread, it will not block shutdown
    new DaemonTimerThread().start();
    // Add a shutdown hook to catch any final events at shutdown
    Runtime.getRuntime().addShutdownHook(new ShutdownHook());
    layout.start();
    super.start();
}
Also used : WarnStatus(ch.qos.logback.core.status.WarnStatus) AmazonClientException(com.amazonaws.AmazonClientException) ErrorStatus(ch.qos.logback.core.status.ErrorStatus) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 5 with ErrorStatus

use of ch.qos.logback.core.status.ErrorStatus in project UniversalMediaServer by UniversalMediaServer.

the class FrameAppender method start.

/**
 * Checks that the required parameters are set and if everything is in
 * order, activates this appender.
 */
@Override
public void start() {
    boolean error = false;
    if (this.encoder == null) {
        error = true;
        addStatus(new ErrorStatus("No encoder set for the appender named [" + name + "].", this));
    }
    if (!error) {
        super.start();
    }
}
Also used : ErrorStatus(ch.qos.logback.core.status.ErrorStatus)

Aggregations

ErrorStatus (ch.qos.logback.core.status.ErrorStatus)8 RecoveryCoordinator (ch.qos.logback.core.recovery.RecoveryCoordinator)1 InfoStatus (ch.qos.logback.core.status.InfoStatus)1 WarnStatus (ch.qos.logback.core.status.WarnStatus)1 AmazonClientException (com.amazonaws.AmazonClientException)1 IOException (java.io.IOException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1