本文整理汇总了Java中ch.qos.logback.core.joran.spi.InterpretationContext.getContext方法的典型用法代码示例。如果您正苦于以下问题:Java InterpretationContext.getContext方法的具体用法?Java InterpretationContext.getContext怎么用?Java InterpretationContext.getContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.qos.logback.core.joran.spi.InterpretationContext
的用法示例。
在下文中一共展示了InterpretationContext.getContext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: end
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
@Override
public void end(InterpretationContext ec, String name) throws ActionException {
if (inError) {
return;
}
Object o = ec.peekObject();
if (o != fruitShell) {
addWarn(
"The object at the of the stack is not the fruitShell named ["
+ fruitShell.getName() + "] pushed earlier.");
} else {
addInfo(
"Popping fruitSHell named [" + fruitShell.getName()
+ "] from the object stack");
ec.popObject();
FruitContext fruitContext = (FruitContext) ec.getContext();
fruitContext.addFruitShell(fruitShell);
}
}
示例2: setProperties
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
/**
* Add all the properties found in the argument named 'props' to an
* InterpretationContext.
*/
static public void setProperties(InterpretationContext ic, Properties props,
Scope scope) {
switch (scope) {
case LOCAL:
ic.addSubstitutionProperties(props);
break;
case CONTEXT:
ContextUtil cu = new ContextUtil(ic.getContext());
cu.addProperties(props);
break;
case SYSTEM:
OptionHelper.setSystemProperties(ic, props);
}
}
示例3: begin
import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
@Override
public void begin(InterpretationContext ec, String name, Attributes attributes)
throws ActionException {
String portStr = attributes.getValue(PORT_ATTR);
Integer port = null;
if (portStr == null) {
port = DEFAULT_PORT;
} else {
try {
port = Integer.valueOf(portStr);
} catch (NumberFormatException ex) {
addError("Port " + portStr
+ " in ConsolePlugin config is not a correct number");
}
}
LoggerContext lc = (LoggerContext)ec.getContext();
SocketAppender appender = new SocketAppender();
appender.setContext(lc);
appender.setIncludeCallerData(true);
appender.setRemoteHost("localhost");
appender.setPort(port.intValue());
appender.start();
Logger root = lc.getLogger(Logger.ROOT_LOGGER_NAME);
root.addAppender(appender);
addInfo("Sending LoggingEvents to the plugin using port " + port);
}