本文整理汇总了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;
}
示例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();
}
}
示例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();
}
}
示例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);
}
}
示例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();
}
示例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);
}
}
}
示例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();
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
}
}
示例13: register
import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
@Override
public void register(LifeCycle component) {
lastComponent = component;
super.register(component);
}
示例14: getLastComponent
import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
public LifeCycle getLastComponent() {
return lastComponent;
}
示例15: register
import ch.qos.logback.core.spi.LifeCycle; //导入依赖的package包/类
@Override
public void register(LifeCycle component) {
lifeCycleManager.register(component);
}