use of ch.qos.logback.core.LogbackException 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);
}
}
use of ch.qos.logback.core.LogbackException in project cdap by caskdata.
the class RollingLocationLogAppender method doAppend.
@Override
public void doAppend(ILoggingEvent eventObject) throws LogbackException {
try {
// logic from AppenderBase
if (!this.started) {
LOG.warn("Attempted to append to non started appender {}", this.getName());
return;
}
// logic from AppenderBase
if (getFilterChainDecision(eventObject) == FilterReply.DENY) {
return;
}
String namespaceId = eventObject.getMDCPropertyMap().get(LocationManager.TAG_NAMESPACE_ID);
if (namespaceId != null && !namespaceId.equals(NamespaceId.SYSTEM.getNamespace())) {
LocationIdentifier logLocationIdentifier = locationManager.getLocationIdentifier(eventObject.getMDCPropertyMap());
rollover(logLocationIdentifier, eventObject);
OutputStream locationOutputStream = locationManager.getLocationOutputStream(logLocationIdentifier, filePath);
setOutputStream(locationOutputStream);
writeOut(eventObject);
}
} catch (IllegalArgumentException iae) {
// this shouldn't happen
LOG.error("Unrecognized context ", iae);
} catch (IOException ioe) {
throw new LogbackException("Exception while appending event. ", ioe);
} catch (RolloverFailure rolloverFailure) {
throw new LogbackException("Exception while rolling over. ", rolloverFailure);
}
}
Aggregations