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


Java Context.getStatusManager方法代码示例

本文整理汇总了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);
    }
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:23,代码来源:StatusPrinter.java

示例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);
    }
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:23,代码来源:StatusPrinter.java

示例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;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:20,代码来源:StatusUtil.java

示例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);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:10,代码来源:ConfigurationWatchListUtil.java

示例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);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:18,代码来源:StatusPrinter.java

示例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);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:11,代码来源:AbstractPatternLayoutBaseTest.java

示例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);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:11,代码来源:AbstractPatternLayoutBaseTest.java

示例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.");
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:15,代码来源:AbstractPatternLayoutBaseTest.java

示例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.");
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:15,代码来源:AbstractPatternLayoutBaseTest.java

示例10: StatusUtil

import ch.qos.logback.core.Context; //导入方法依赖的package包/类
public StatusUtil(Context context) {
  this.sm = context.getStatusManager();
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:4,代码来源:StatusUtil.java


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