ch.qos.logback.core.UnsynchronizedAppenderBase类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(337)

本文整理了Java中ch.qos.logback.core.UnsynchronizedAppenderBase类的一些代码示例,展示了UnsynchronizedAppenderBase类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UnsynchronizedAppenderBase类的具体详情如下:
包路径:ch.qos.logback.core.UnsynchronizedAppenderBase
类名称:UnsynchronizedAppenderBase

UnsynchronizedAppenderBase介绍

[英]Similar to AppenderBase except that derived appenders need to handle thread synchronization on their own.
[中]与AppenderBase类似,只是派生appender需要自己处理线程同步。

代码示例

代码示例来源:origin: line/armeria

@Override
public void start() {
  if (!aai.iteratorForAppenders().hasNext()) {
    addWarn("No appender was attached to " + getClass().getSimpleName() + '.');
  }
  if (exporter == null) {
    exporter = builder.build();
  }
  super.start();
}

代码示例来源:origin: line/armeria

@Override
public void stop() {
  try {
    aai.detachAndStopAllAppenders();
  } finally {
    super.stop();
  }
}

代码示例来源:origin: camunda/camunda-bpm-platform

addStatus(new WarnStatus(
    "Attempted to append to non started appender [" + name + "].",
    this));
if (getFilterChainDecision(eventObject) == FilterReply.DENY) {
 return;
this.append(eventObject);
 addError("Appender [" + name + "] failed to append.", e);

代码示例来源:origin: googleapis/google-cloud-java

/** Initialize and configure the cloud logging service. */
@Override
public synchronized void start() {
 if (isStarted()) {
  return;
 }
 MonitoredResource resource = getMonitoredResource(getProjectId());
 defaultWriteOptions =
   new WriteOption[] {WriteOption.logName(getLogName()), WriteOption.resource(resource)};
 getLogging().setFlushSeverity(severityFor(getFlushLevel()));
 loggingEnhancers = new ArrayList<>();
 List<LoggingEnhancer> resourceEnhancers = MonitoredResourceUtil.getResourceEnhancers();
 loggingEnhancers.addAll(resourceEnhancers);
 loggingEnhancers.addAll(getLoggingEnhancers());
 loggingEventEnhancers = new ArrayList<>();
 loggingEventEnhancers.addAll(getLoggingEventEnhancers());
 super.start();
}

代码示例来源:origin: googleapis/google-cloud-java

@Override
public synchronized void stop() {
 if (logging != null) {
  try {
   logging.close();
  } catch (Exception ex) {
   // ignore
  }
 }
 logging = null;
 super.stop();
}

代码示例来源:origin: tony19/logback-android

addStatus(new WarnStatus(
    "Attempted to append to non started appender [" + name + "].",
    this));
if (getFilterChainDecision(eventObject) == FilterReply.DENY) {
 return;
this.append(eventObject);
 addError("Appender [" + name + "] failed to append.", e);

代码示例来源:origin: prometheus/client_java

@Override
public void start() {
 super.start();
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
 public void stop() {
  super.stop();
 }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

public void doAppend(E eventObject) {
  // WARNING: The guard check MUST be the first statement in the
  // doAppend() method.
  // prevent re-entry.
  if (Boolean.TRUE.equals(guard.get())) {
    return;
  }
  try {
    guard.set(Boolean.TRUE);
    if (!this.started) {
      if (statusRepeatCount++ < ALLOWED_REPEATS) {
        addStatus(new WarnStatus("Attempted to append to non started appender [" + name + "].", this));
      }
      return;
    }
    if (getFilterChainDecision(eventObject) == FilterReply.DENY) {
      return;
    }
    // ok, we now invoke derived class' implementation of append
    this.append(eventObject);
  } catch (Exception e) {
    if (exceptionCount++ < ALLOWED_REPEATS) {
      addError("Appender [" + name + "] failed to append.", e);
    }
  } finally {
    guard.set(Boolean.FALSE);
  }
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public void start() {
 if (connectionSource == null) {
  throw new IllegalStateException(
    "DBAppender cannot function without a connection source");
 }
 sqlDialect = DBUtil
   .getDialectFromCode(connectionSource.getSQLDialectCode());
 if (getGeneratedKeysMethod() != null) {
  cnxSupportsGetGeneratedKeys = connectionSource.supportsGetGeneratedKeys();
 } else {
  cnxSupportsGetGeneratedKeys = false;
 }
 cnxSupportsBatchUpdates = connectionSource.supportsBatchUpdates();
 if (!cnxSupportsGetGeneratedKeys && (sqlDialect == null)) {
  throw new IllegalStateException(
    "DBAppender cannot function if the JDBC driver does not support getGeneratedKeys method *and* without a specific SQL dialect");
 }
 // all nice and dandy on the eastern front
 super.start();
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Stop this appender instance. The underlying stream or writer is also
 * closed.
 * 
 * <p>
 * Stopped appenders cannot be reused.
 */
public void stop() {
 lock.lock();
 try {
  closeOutputStream();
  super.stop();
 } finally {
  lock.unlock();
 }
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

public void doAppend(E eventObject) {
 // WARNING: The guard check MUST be the first statement in the
 // doAppend() method.
 // prevent re-entry.
 if (guard.get()) {
  return;
 }
 try {
  guard.set(true);
  if (!this.started) {
   if (statusRepeatCount++ < ALLOWED_REPEATS) {
    addStatus(new WarnStatus(
      "Attempted to append to non started appender [" + name + "].",
      this));
   }
   return;
  }
  if (getFilterChainDecision(eventObject) == FilterReply.DENY) {
   return;
  }
  // ok, we now invoke derived class' implementation of append
  this.append(eventObject);
 } catch (Exception e) {
  if (exceptionCount++ < ALLOWED_REPEATS) {
   addError("Appender [" + name + "] failed to append.", e);
  }
 } finally {
  guard.set(false);
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Checks that requires parameters are set and if everything is in order,
 * activates this appender.
 */
public void start() {
 int errors = 0;
 if (this.encoder == null) {
  addStatus(new ErrorStatus("No encoder set for the appender named \""
    + name + "\".", this));
  errors++;
 }
 if (this.outputStream == null) {
  addStatus(new ErrorStatus(
    "No output stream set for the appender named \"" + name + "\".", this));
  errors++;
 }
 // only error free appenders should be activated
 if (errors == 0) {
  super.start();
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public void stop() {
 if (!isStarted())
  return;
 // mark this appender as stopped so that Worker can also processPriorToRemoval if it is invoking aii.appendLoopOnAppenders
 // and sub-appenders consume the interruption
 super.stop();
 // interrupt the worker thread so that it can terminate. Note that the interruption can be consumed
 // by sub-appenders
 worker.interrupt();
 try {
  worker.join(1000);
 } catch (InterruptedException e) {
  addError("Failed to join worker thread", e);
 }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

public void doAppend(E eventObject) {
  // WARNING: The guard check MUST be the first statement in the
  // doAppend() method.
  // prevent re-entry.
  if (Boolean.TRUE.equals(guard.get())) {
    return;
  }
  try {
    guard.set(Boolean.TRUE);
    if (!this.started) {
      if (statusRepeatCount++ < ALLOWED_REPEATS) {
        addStatus(new WarnStatus("Attempted to append to non started appender [" + name + "].", this));
      }
      return;
    }
    if (getFilterChainDecision(eventObject) == FilterReply.DENY) {
      return;
    }
    // ok, we now invoke derived class' implementation of append
    this.append(eventObject);
  } catch (Exception e) {
    if (exceptionCount++ < ALLOWED_REPEATS) {
      addError("Appender [" + name + "] failed to append.", e);
    }
  } finally {
    guard.set(Boolean.FALSE);
  }
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public void start() {
 if (appenderCount == 0) {
  addError("No attached appenders found.");
  return;
 }
 if (queueSize < 1) {
  addError("Invalid queue size [" + queueSize + "]");
  return;
 }
 blockingQueue = new ArrayBlockingQueue<E>(queueSize);
 if (discardingThreshold == UNDEFINED)
  discardingThreshold = queueSize / 5;
 addInfo("Setting discardingThreshold to " + discardingThreshold);
 worker.setDaemon(true);
 worker.setName("AsyncAppender-Worker-" + worker.getName());
 // make sure this instance is marked as "started" before staring the worker Thread
 super.start();
 worker.start();
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

@Override
  public void stop() {
    super.stop();
  }
}

代码示例来源:origin: Nextdoor/bender

public void doAppend(E eventObject) {
  // WARNING: The guard check MUST be the first statement in the
  // doAppend() method.
  // prevent re-entry.
  if (Boolean.TRUE.equals(guard.get())) {
    return;
  }
  try {
    guard.set(Boolean.TRUE);
    if (!this.started) {
      if (statusRepeatCount++ < ALLOWED_REPEATS) {
        addStatus(new WarnStatus("Attempted to append to non started appender [" + name + "].", this));
      }
      return;
    }
    if (getFilterChainDecision(eventObject) == FilterReply.DENY) {
      return;
    }
    // ok, we now invoke derived class' implementation of append
    this.append(eventObject);
  } catch (Exception e) {
    if (exceptionCount++ < ALLOWED_REPEATS) {
      addError("Appender [" + name + "] failed to append.", e);
    }
  } finally {
    guard.set(Boolean.FALSE);
  }
}

代码示例来源:origin: io.prometheus/simpleclient_logback

@Override
public void start() {
 super.start();
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

@Override
  public void stop() {
    super.stop();
  }
}

相关文章