Esempio n. 1
0
 private void setTraceAppenderThreshold(Logger logger, Level level) {
   Enumeration e = logger.getAllAppenders();
   while (e.hasMoreElements()) {
     AppenderSkeleton appender = (AppenderSkeleton) e.nextElement();
     if (appender.getName().equals(traceAppenderName)) {
       appender.setThreshold(level);
     }
   }
 }
  @Override
  public void activateOptions() {
    super.activateOptions();

    if (manager == null) {
      manager = MessageManager.getInstance();
      Properties senderProperties = new Properties();
      senderProperties.put(MessageManager.collectorsProperty, collectors);
      senderProperties.put(MessageManager.senderTimeOutProperty, "" + senderTimeOut);
      senderProperties.put(MessageManager.coreThreadProperty, "" + coreThreadCount);
      if (senderType != null) {
        senderProperties.put(MessageManager.senderTypeProperty, senderType);
      }
      manager.start(senderProperties);
    }

    if (initDone == false) {
      synchronized (lock) {
        if (initDone == false) {
          initDone = true;
        } else {
          return;
        }
      }

      Properties consumerProperties = new Properties();
      consumerProperties.put(MessageManager.sourceProperty, source);
      consumerProperties.put(MessageManager.streamNameProperty, streamName);
      consumerProperties.put(MessageManager.applicationProperty, application);
      consumerProperties.put(MessageManager.dataTypeProperty, dataType);

      tags =
          tags
              + " version=\""
              + HonuLog4jStreamingAppender.class.getPackage().getImplementationVersion()
              + "\" ";

      consumerProperties.put(MessageManager.tagsProperty, tags);
      consumerProperties.put(MessageManager.thresholdProperty, "" + messageQueueThreshold);
      consumerProperties.put(MessageManager.samplingPeriodProperty, "" + samplingPeriod);
      consumerProperties.put(
          MessageManager.maxMessageCountPerChunkProperty, "" + maxMessageCountPerChunk);
      consumer = manager.createConsumer(consumerProperties);
    }
  }
Esempio n. 3
0
 @Override
 public void activateOptions() {
   super.activateOptions();
   if (Ignitor.isIgnited()) return;
   try {
     final XMLConfigurator xmlCofig = XmlConfiguratorLoader.loadForPureJavaProgram();
     if (xmlCofig == null)
       throw new IgnitionFailureException(
           "cannot find Configuration:["
               + XmlConfiguratorLoader.ZMONITOR_XML
               + "] from current application context: "
               + this.getClass());
     isIgnitBySelf = Ignitor.ignite(new ThreadLocalTimelineLifecycleManager(), xmlCofig);
     ZMLog.info(">> Ignit ZMonitor in: ", ZMonitorAppender.class.getCanonicalName());
   } catch (IOException e) {
     throw new IgnitionFailureException(e);
   }
 }
  public void activateOptions() {
    LogLog.debug("DBAppender.activateOptions called");

    if (connectionSource == null) {
      throw new IllegalStateException("DBAppender cannot function without a connection source");
    }

    sqlDialect = Util.getDialectFromCode(connectionSource.getSQLDialectCode());
    if (GET_GENERATED_KEYS_METHOD != 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.activateOptions();
  }
Esempio n. 5
0
 @Override
 public synchronized void doAppend(LoggingEvent event) {
   super.doAppend(event);
 }
Esempio n. 6
0
 /** Called once all the options have been set. */
 public void activateOptions() {
   super.activateOptions();
 }