当前位置: 首页>>代码示例>>Java>>正文


Java LifeCycle类代码示例

本文整理汇总了Java中ch.qos.logback.core.spi.LifeCycle的典型用法代码示例。如果您正苦于以下问题:Java LifeCycle类的具体用法?Java LifeCycle怎么用?Java LifeCycle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LifeCycle类属于ch.qos.logback.core.spi包,在下文中一共展示了LifeCycle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureAppender

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
private Appender<ILoggingEvent> configureAppender(LoggerContext loggerContext, String name, Config config)
		throws ReflectiveOperationException {
	List<Object> children = new ArrayList<>();

	@SuppressWarnings("unchecked")
	Class<Appender<ILoggingEvent>> clazz = (Class<Appender<ILoggingEvent>>) Class
			.forName(config.getString("class"));

	Appender<ILoggingEvent> appender = this.configureObject(loggerContext, clazz, config, children);
	appender.setName(name);

	for (Object child : children) {
		if (child instanceof RollingPolicy) {
			((RollingPolicy) child).setParent((FileAppender<?>) appender);
		}
		if (child instanceof LifeCycle) {
			((LifeCycle) child).start();
		}
	}

	appender.start();
	return appender;

}
 
开发者ID:gnieh,项目名称:logback-config,代码行数:25,代码来源:ConfigConfigurator.java

示例2: end

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
/**
 * Once the children elements are also parsed, now is the time to activate the
 * appender options.
 */
public void end(InterpretationContext ec, String name) {
  if (inError) {
    return;
  }

  if (appender instanceof LifeCycle) {
    ((LifeCycle) appender).start();
  }

  Object o = ec.peekObject();

  if (o != appender) {
    addWarn("The object at the of the stack is not the appender named ["
        + appender.getName() + "] pushed earlier.");
  } else {
    ec.popObject();
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:23,代码来源:AppenderAction.java

示例3: end

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
@Override
public void end(InterpretationContext ec, String name) throws ActionException {
  if (inError) {
    return;
  }
  Object o = ec.peekObject();

  if (o != lcl) {
    addWarn("The object on the top the of the stack is not the LoggerContextListener pushed earlier.");
  } else {
    if (lcl instanceof LifeCycle) {
      ((LifeCycle) lcl).start();
      addInfo("Starting LoggerContextListener");
    }
    ((LoggerContext) context).addListener(lcl);
    ec.popObject();
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:19,代码来源:LoggerContextListenerAction.java

示例4: initAndAddListener

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
private static void initAndAddListener(KonkerLoggerContext loggerContext, StatusListener listener) {
    if(listener != null) {
        if(listener instanceof ContextAware) {
            ((ContextAware)listener).setContext(loggerContext);
        }

        if(listener instanceof LifeCycle) {
            ((LifeCycle)listener).start();
        }

        loggerContext.getStatusManager().add(listener);
    }

}
 
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:15,代码来源:KonkerStatusListenerConfigHelper.java

示例5: reset

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
/**
 * Resets this manager.
 * <p>
 * All registered components are stopped and removed from the manager.
 */
public void reset() {
  for (LifeCycle component : components) {
    if (component.isStarted()) {
      component.stop();
    }
  }
  components.clear();
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:14,代码来源:LifeCycleManager.java

示例6: end

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
/**
 * Once the children elements are also parsed, now is the time to activate the
 * evaluator options.
 */
@SuppressWarnings("unchecked")
public void end(InterpretationContext ec, String e) {
  if (inError) {
    return;
  }

  if (evaluator instanceof LifeCycle) {
    ((LifeCycle) evaluator).start();
    addInfo("Starting evaluator named [" + evaluator.getName() + "]");
  }

  Object o = ec.peekObject();

  if (o != evaluator) {
    addWarn("The object on the top the of the stack is not the evaluator pushed earlier.");
  } else {
    ec.popObject();

    try {
      Map<String, EventEvaluator<?>> evaluatorMap = (Map<String, EventEvaluator<?>>) context
          .getObject(CoreConstants.EVALUATOR_MAP);
      if(evaluatorMap == null) {
        addError("Could not find EvaluatorMap");
      } else {
        evaluatorMap.put(evaluator.getName(), evaluator);
      }
    } catch (Exception ex) {
      addError("Could not set evaluator named [" + evaluator + "].", ex);
    }
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:36,代码来源:AbstractEventEvaluatorAction.java

示例7: end

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
public void end(InterpretationContext ec, String e) {
  if (inError) {
    return;
  }
  if (statusListener instanceof LifeCycle) {
    ((LifeCycle) statusListener).start();
  }
  Object o = ec.peekObject();
  if (o != statusListener) {
    addWarn("The object at the of the stack is not the statusListener pushed earlier.");
  } else {
    ec.popObject();
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:15,代码来源:StatusListenerAction.java

示例8: initAndAddListener

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
private static void initAndAddListener(LoggerContext loggerContext, StatusListener listener) {
  if (listener != null) {
    if(listener instanceof ContextAware) // LOGBACK-767
      ((ContextAware) listener).setContext(loggerContext);
    if(listener instanceof LifeCycle)  // LOGBACK-767
      ((LifeCycle) listener).start();
    loggerContext.getStatusManager().add(listener);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:10,代码来源:StatusListenerConfigHelper.java

示例9: buildLifeCycle

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
private <T extends LifeCycle> T buildLifeCycle(T lifeCycle, boolean start) {
    if (lifeCycle instanceof ContextAware) {
        ((ContextAware) lifeCycle).setContext(this.loggerContext);
    }

    if (start) {
        lifeCycle.start();
    }

    return lifeCycle;
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:12,代码来源:LoggingInitializerRunListener.java

示例10: start

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
public void start(LifeCycle lifeCycle) {
	if (lifeCycle instanceof ContextAware) {
		((ContextAware) lifeCycle).setContext(this.context);
	}
	lifeCycle.start();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:LogbackConfigurator.java

示例11: register

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
public void register(LifeCycle component) {
  getLifeCycleManager().register(component);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:4,代码来源:ContextBase.java

示例12: end

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
public void end(InterpretationContext ec, String tagName) {

    // pop the action data object pushed in isApplicable() method call
    // we assume that each this begin
    IADataForComplexProperty actionData = (IADataForComplexProperty) actionDataStack
        .pop();

    if (actionData.inError) {
      return;
    }

    PropertySetter nestedBean = new PropertySetter(actionData
        .getNestedComplexProperty());
    nestedBean.setContext(context);

    // have the nested element point to its parent if possible
    if (nestedBean.computeAggregationType("parent") == AggregationType.AS_COMPLEX_PROPERTY) {
      nestedBean.setComplexProperty("parent", actionData.parentBean.getObj());
    }

    // start the nested complex property if it implements LifeCycle and is not
    // marked with a @NoAutoStart annotation
    Object nestedComplexProperty = actionData.getNestedComplexProperty();
    if (nestedComplexProperty instanceof LifeCycle
        && NoAutoStartUtil.notMarkedWithNoAutoStart(nestedComplexProperty)) {
      ((LifeCycle) nestedComplexProperty).start();
    }

    Object o = ec.peekObject();

    if (o != actionData.getNestedComplexProperty()) {
      addError("The object on the top the of the stack is not the component pushed earlier.");
    } else {
      ec.popObject();
      // Now let us attach the component
      switch (actionData.aggregationType) {
      case AS_COMPLEX_PROPERTY:
        actionData.parentBean.setComplexProperty(tagName, actionData
            .getNestedComplexProperty());

        break;
      case AS_COMPLEX_PROPERTY_COLLECTION:
        actionData.parentBean.addComplexProperty(tagName, actionData
            .getNestedComplexProperty());

        break;
      }
    }
  }
 
开发者ID:cscfa,项目名称:bartleby,代码行数:50,代码来源:NestedComplexPropertyIA.java

示例13: register

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
@Override
public void register(LifeCycle component) {
  lastComponent = component;
  super.register(component);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:6,代码来源:ContextBaseTest.java

示例14: getLastComponent

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
public LifeCycle getLastComponent() {
  return lastComponent;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:4,代码来源:ContextBaseTest.java

示例15: register

import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
@Override
public void register(LifeCycle component) {
  lifeCycleManager.register(component);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:5,代码来源:LogbackValve.java


注:本文中的ch.qos.logback.core.spi.LifeCycle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。