Search in sources :

Example 1 with WarnStatus

use of ch.qos.logback.core.status.WarnStatus in project cdap by caskdata.

the class CDAPLogAppender method doAppend.

@Override
public void doAppend(ILoggingEvent eventObject) throws LogbackException {
    if (logFileManager == null) {
        return;
    }
    long timestamp = eventObject.getTimeStamp();
    try {
        // logic from AppenderBase
        if (!this.started) {
            addStatus(new WarnStatus("Attempted to append to non started appender [" + name + "].", this));
            return;
        }
        // logic from AppenderBase
        if (getFilterChainDecision(eventObject) == FilterReply.DENY) {
            return;
        }
        LogPathIdentifier logPathIdentifier = getLoggingPath(eventObject.getMDCPropertyMap());
        LogFileOutputStream outputStream = logFileManager.getLogFileOutputStream(logPathIdentifier, timestamp);
        outputStream.append(eventObject);
    } catch (IllegalArgumentException iae) {
        // this shouldn't happen
        LOG.error("Unrecognized context ", iae);
    } catch (IOException ioe) {
        throw new LogbackException("Exception during append", ioe);
    }
}
Also used : WarnStatus(ch.qos.logback.core.status.WarnStatus) IOException(java.io.IOException) LogbackException(ch.qos.logback.core.LogbackException)

Example 2 with WarnStatus

use of ch.qos.logback.core.status.WarnStatus in project cassandra by apache.

the class ConsoleAppender method setTarget.

public void setTarget(String target) {
    if (!(target.equals("System.out") || target.equals("System.err"))) {
        Status status = new WarnStatus("[" + target + "] should be one of System.out or System.err", this);
        status.add(new WarnStatus("Using default target System.out", this));
        addStatus(status);
        return;
    }
    this.target = target;
}
Also used : WarnStatus(ch.qos.logback.core.status.WarnStatus) Status(ch.qos.logback.core.status.Status) WarnStatus(ch.qos.logback.core.status.WarnStatus)

Aggregations

WarnStatus (ch.qos.logback.core.status.WarnStatus)2 LogbackException (ch.qos.logback.core.LogbackException)1 Status (ch.qos.logback.core.status.Status)1 IOException (java.io.IOException)1