本文整理汇总了Java中ch.qos.logback.core.Context.getStatusManager方法的典型用法代码示例。如果您正苦于以下问题:Java Context.getStatusManager方法的具体用法?Java Context.getStatusManager怎么用?Java Context.getStatusManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.qos.logback.core.Context
的用法示例。
在下文中一共展示了Context.getStatusManager方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printInCaseOfErrorsOrWarnings
import ch.qos.logback.core.Context; //导入方法依赖的package包/类
/**
* Print the contents of the context status, but only if they contain
* warnings or errors occurring later then the threshold.
*
* @param context
*/
public static void printInCaseOfErrorsOrWarnings(Context context, long threshold) {
if (context == null) {
throw new IllegalArgumentException("Context argument cannot be null");
}
StatusManager sm = context.getStatusManager();
if (sm == null) {
ps.println("WARN: Context named \"" + context.getName()
+ "\" has no status manager");
} else {
StatusUtil statusUtil = new StatusUtil(context);
if (statusUtil.getHighestLevel(threshold) >= ErrorStatus.WARN) {
print(sm, threshold);
}
}
}
示例2: printIfErrorsOccured
import ch.qos.logback.core.Context; //导入方法依赖的package包/类
/**
* Print the contents of the context statuses, but only if they contain
* errors.
*
* @param context
*/
public static void printIfErrorsOccured(Context context) {
if (context == null) {
throw new IllegalArgumentException("Context argument cannot be null");
}
StatusManager sm = context.getStatusManager();
if (sm == null) {
ps.println("WARN: Context named \"" + context.getName()
+ "\" has no status manager");
} else {
StatusUtil statusUtil = new StatusUtil(context);
if (statusUtil.getHighestLevel(0) == ErrorStatus.ERROR) {
print(sm);
}
}
}
示例3: contextHasStatusListener
import ch.qos.logback.core.Context; //导入方法依赖的package包/类
/**
* Returns true if the StatusManager associated with the context passed
* as parameter has one or more StatusListener instances registered. Returns
* false otherwise.
*
* @param context
* @return true if one or more StatusListeners registered, false otherwise
* @since 1.0.8
*/
static public boolean contextHasStatusListener(Context context) {
StatusManager sm = context.getStatusManager();
if(sm == null)
return false;
List<StatusListener> listeners = sm.getCopyOfStatusListenerList();
if(listeners == null || listeners.size() == 0)
return false;
else
return true;
}
示例4: addStatus
import ch.qos.logback.core.Context; //导入方法依赖的package包/类
static void addStatus(Context context, Status s) {
if (context == null) {
System.out.println("Null context in " + ConfigurationWatchList.class.getName());
return;
}
StatusManager sm = context.getStatusManager();
if (sm == null) return;
sm.add(s);
}
示例5: print
import ch.qos.logback.core.Context; //导入方法依赖的package包/类
/**
* Print context's status data with a timestamp higher than the threshold.
* @param context
*/
public static void print(Context context, long threshold) {
if (context == null) {
throw new IllegalArgumentException("Context argument cannot be null");
}
StatusManager sm = context.getStatusManager();
if (sm == null) {
ps.println("WARN: Context named \"" + context.getName()
+ "\" has no status manager");
} else {
print(sm, threshold);
}
}
示例6: testUnStarted
import ch.qos.logback.core.Context; //导入方法依赖的package包/类
@Test
public void testUnStarted() {
PatternLayoutBase<E> plb = getPatternLayoutBase();
Context context = new ContextBase();
plb.setContext(context);
String s = plb.doLayout(getEventObject());
assertEquals("", s);
StatusManager sm = context.getStatusManager();
StatusPrinter.print(sm);
}
示例7: testStarted
import ch.qos.logback.core.Context; //导入方法依赖的package包/类
@Test
public void testStarted() {
PatternLayoutBase<E> plb = getPatternLayoutBase();
Context context = new ContextBase();
plb.setContext(context);
String s = plb.doLayout(getEventObject());
assertEquals("", s);
StatusManager sm = context.getStatusManager();
StatusPrinter.print(sm);
}
示例8: testNullPattern
import ch.qos.logback.core.Context; //导入方法依赖的package包/类
@Test
public void testNullPattern() {
//System.out.println("testNullPattern");
PatternLayoutBase<E> plb = getPatternLayoutBase();
Context context = new ContextBase();
plb.setContext(context);
plb.setPattern(null);
plb.start();
String s = plb.doLayout(getEventObject());
assertEquals("", s);
StatusChecker checker = new StatusChecker(context.getStatusManager());
//StatusPrinter.print(context);
checker.assertContainsMatch("Empty or null pattern.");
}
示例9: testEmptyPattern
import ch.qos.logback.core.Context; //导入方法依赖的package包/类
@Test
public void testEmptyPattern() {
//System.out.println("testNullPattern");
PatternLayoutBase<E> plb = getPatternLayoutBase();
Context context = new ContextBase();
plb.setContext(context);
plb.setPattern("");
plb.start();
String s = plb.doLayout(getEventObject());
assertEquals("", s);
StatusChecker checker = new StatusChecker(context.getStatusManager());
//StatusPrinter.print(context);
checker.assertContainsMatch("Empty or null pattern.");
}
示例10: StatusUtil
import ch.qos.logback.core.Context; //导入方法依赖的package包/类
public StatusUtil(Context context) {
this.sm = context.getStatusManager();
}