本文整理汇总了Java中ch.qos.logback.core.spi.DeferredProcessingAware类的典型用法代码示例。如果您正苦于以下问题:Java DeferredProcessingAware类的具体用法?Java DeferredProcessingAware怎么用?Java DeferredProcessingAware使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeferredProcessingAware类属于ch.qos.logback.core.spi包,在下文中一共展示了DeferredProcessingAware类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: subAppend
import ch.qos.logback.core.spi.DeferredProcessingAware; //导入依赖的package包/类
/**
* Actual writing occurs here.
* <p>
* Most subclasses of <code>WriterAppender</code> will need to override this
* method.
*
* @since 0.9.0
*/
protected void subAppend(E event) {
if (!isStarted()) {
return;
}
try {
// this step avoids LBCLASSIC-139
if (event instanceof DeferredProcessingAware) {
((DeferredProcessingAware) event).prepareForDeferredProcessing();
}
// the synchronization prevents the OutputStream from being closed while we
// are writing. It also prevents multiple threads from entering the same
// converter. Converters assume that they are in a synchronized block.
lock.lock();
try {
writeOut(event);
} finally {
lock.unlock();
}
} catch (IOException ioe) {
// as soon as an exception occurs, move to non-started state
// and add a single ErrorStatus to the SM.
this.started = false;
addStatus(new ErrorStatus("IO failure in appender", this, ioe));
}
}
示例2: append
import ch.qos.logback.core.spi.DeferredProcessingAware; //导入依赖的package包/类
@Override
protected synchronized void append(final E event) {
if (!isStarted()) {
return;
}
try {
if (event instanceof DeferredProcessingAware) {
((DeferredProcessingAware) event).prepareForDeferredProcessing();
}
this.encoder.doEncode(event);
} catch (final IOException ex) {
stop();
addStatus(new ErrorStatus("IO failure in appender named \"" + this.name + "\".",
this, ex));
}
}
示例3: subAppend
import ch.qos.logback.core.spi.DeferredProcessingAware; //导入依赖的package包/类
/**
*
* @param eventObject
*/
private void subAppend(ILoggingEvent eventObject) {
if (!isStarted()) {
return;
}
try {
// this step avoids LBCLASSIC-139
if (eventObject instanceof DeferredProcessingAware) {
((DeferredProcessingAware) eventObject).prepareForDeferredProcessing();
}
this.encoder.doEncode(eventObject);
} catch (IOException ioe) {
this.started = false;
addStatus(new ErrorStatus("IO failure in appender", this, ioe));
}
}
示例4: writeTo
import ch.qos.logback.core.spi.DeferredProcessingAware; //导入依赖的package包/类
@Override
public void writeTo(JsonGenerator generator, DeferredProcessingAware deferredProcessingAware) throws IOException {
generator.writeFieldName("service");
generator.writeString(serviceName);
generator.writeFieldName("service-version");
generator.writeString(serviceVersion);
generator.writeFieldName("service-id");
generator.writeString(serviceInstanceId);
}
示例5: withName
import ch.qos.logback.core.spi.DeferredProcessingAware; //导入依赖的package包/类
private <T extends DeferredProcessingAware> AbstractFieldJsonProvider<T> withName(
String name,
AbstractFieldJsonProvider<T> provider,
LoggerContext context
) {
provider.setContext(context);
provider.setFieldName(name);
return provider;
}
示例6: appendUnsafe
import ch.qos.logback.core.spi.DeferredProcessingAware; //导入依赖的package包/类
/**
* Appends an event in order to be logged. This method is unsafe concerning the fact that the event is lost
* if the Jedis client connection has timed out due to a redis connection timeout (configured on the
* redis server).
*
* @param event event to be appended
*/
private void appendUnsafe(DeferredProcessingAware event) {
if (event != null) {
rpushAndSyncIfBatchFinished(event);
} else {
sendBatch(batchConfig.getProcessedBatchItemsCount());
}
}
示例7: rpushAndSyncIfBatchFinished
import ch.qos.logback.core.spi.DeferredProcessingAware; //导入依赖的package包/类
private void rpushAndSyncIfBatchFinished(DeferredProcessingAware event) {
pipeline.rpush(connectionConfig.getKey(), createEncodedEvent(event));
batchConfig.addBatchItem();
final int batchSize = batchConfig.getProcessedBatchItemsCount();
if (batchConfig.isBatchFinished()) {
sendBatch(batchSize);
}
}
示例8: createEncodedEvent
import ch.qos.logback.core.spi.DeferredProcessingAware; //导入依赖的package包/类
private String createEncodedEvent(DeferredProcessingAware event) {
try (ByteArrayOutputStream eventOutputStream = new ByteArrayOutputStream(BUFFER_SIZE)) {
encoder.init(eventOutputStream);
encoder.doEncode(event);
return eventOutputStream.toString("UTF-8");
} catch (IOException e) {
throw new IllegalStateException("error while initializing the event encoder", e);
}
}
示例9: subAppend
import ch.qos.logback.core.spi.DeferredProcessingAware; //导入依赖的package包/类
private void subAppend(E event) {
if (event instanceof DeferredProcessingAware) {
((DeferredProcessingAware) event).prepareForDeferredProcessing();
}
append(this.encoder.encode(event));
}
示例10: getEncoder
import ch.qos.logback.core.spi.DeferredProcessingAware; //导入依赖的package包/类
public Encoder<DeferredProcessingAware> getEncoder() {
return encoder;
}
示例11: setEncoder
import ch.qos.logback.core.spi.DeferredProcessingAware; //导入依赖的package包/类
public void setEncoder(Encoder<DeferredProcessingAware> encoder) {
this.encoder = encoder;
}