ch.qos.logback.core.AsyncAppenderBase.addError()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(11.5k)|赞(0)|评价(0)|浏览(244)

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

AsyncAppenderBase.addError介绍

暂无

代码示例

代码示例来源: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: 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: ch.qos.logback/core

@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: com.hynnet/logback-core

@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-" + getName());
 // make sure this instance is marked as "started" before staring the worker Thread
 super.start();
 worker.start();
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core

@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: tony19/logback-android

@Override
public void start() {
 if (isStarted()) {
  return;
 }
 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-" + 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 start() {
  if (isStarted())
    return;
  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-" + getName());
  // make sure this instance is marked as "started" before staring the worker Thread
  super.start();
  worker.start();
}

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

@Override
public void start() {
  if (isStarted())
    return;
  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-" + getName());
  // make sure this instance is marked as "started" before staring the worker Thread
  super.start();
  worker.start();
}

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

@Override
public void start() {
  if (isStarted())
    return;
  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-" + getName());
  // make sure this instance is marked as "started" before staring the worker Thread
  super.start();
  worker.start();
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core

@Override
public void stop() {
 if (!isStarted())
  return;
 // mark this appender as stopped so that Worker can also stop 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: ch.qos.logback/core

@Override
public void stop() {
 if (!isStarted())
  return;
 // mark this appender as stopped so that Worker can also stop 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: com.hynnet/logback-core

@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(maxFlushTime);
  
  //check to see if the thread ended and if not add a warning message
  if(worker.isAlive()) {
   addWarn("Max queue flush timeout (" + maxFlushTime + " ms) exceeded. Approximately " + blockingQueue.size() +
     " queued events were possibly discarded.");
  }else {
   addInfo("Queue flush finished successfully within timeout.");
  }
  
 } catch (InterruptedException e) {
  addError("Failed to join worker thread. " + blockingQueue.size() + " queued events may be discarded.", e);
 }
}

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

@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(maxFlushTime);
    // check to see if the thread ended and if not add a warning message
    if (worker.isAlive()) {
      addWarn("Max queue flush timeout (" + maxFlushTime + " ms) exceeded. Approximately " + blockingQueue.size()
              + " queued events were possibly discarded.");
    } else {
      addInfo("Queue flush finished successfully within timeout.");
    }
  } catch (InterruptedException e) {
    addError("Failed to join worker thread. " + blockingQueue.size() + " queued events may be discarded.", e);
  }
}

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

@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();
  InterruptUtil interruptUtil = new InterruptUtil(context);
  try {
    interruptUtil.maskInterruptFlag();
    worker.join(maxFlushTime);
    // check to see if the thread ended and if not add a warning message
    if (worker.isAlive()) {
      addWarn("Max queue flush timeout (" + maxFlushTime + " ms) exceeded. Approximately " + blockingQueue.size()
              + " queued events were possibly discarded.");
    } else {
      addInfo("Queue flush finished successfully within timeout.");
    }
  } catch (InterruptedException e) {
    int remaining = blockingQueue.size();
    addError("Failed to join worker thread. " + remaining + " queued events may be discarded.", e);
  } finally {
    interruptUtil.unmaskInterruptFlag();
  }
}

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

@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();
 InterruptUtil interruptUtil = new InterruptUtil(context);
 try {
  interruptUtil.maskInterruptFlag();
  worker.join(maxFlushTime);
  //check to see if the thread ended and if not add a warning message
  if (worker.isAlive()) {
   addWarn("Max queue flush timeout (" + maxFlushTime + " ms) exceeded. " + blockingQueue.size() +
   " queued events were possibly discarded.");
  } else {
   addInfo("Queue flush finished successfully within timeout.");
  }
 } catch (InterruptedException e) {
  int remaining = blockingQueue.size();
  addError("Failed to join worker thread. " + remaining + " queued events may be discarded.", e);
 } finally {
  interruptUtil.unmaskInterruptFlag();
 }
}

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

@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();
  InterruptUtil interruptUtil = new InterruptUtil(context);
  try {
    interruptUtil.maskInterruptFlag();
    worker.join(maxFlushTime);
    // check to see if the thread ended and if not add a warning message
    if (worker.isAlive()) {
      addWarn("Max queue flush timeout (" + maxFlushTime + " ms) exceeded. Approximately " + blockingQueue.size()
              + " queued events were possibly discarded.");
    } else {
      addInfo("Queue flush finished successfully within timeout.");
    }
  } catch (InterruptedException e) {
    int remaining = blockingQueue.size();
    addError("Failed to join worker thread. " + remaining + " queued events may be discarded.", e);
  } finally {
    interruptUtil.unmaskInterruptFlag();
  }
}

相关文章