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


Java LoggingEvent.setMarker方法代码示例

本文整理汇总了Java中ch.qos.logback.classic.spi.LoggingEvent.setMarker方法的典型用法代码示例。如果您正苦于以下问题:Java LoggingEvent.setMarker方法的具体用法?Java LoggingEvent.setMarker怎么用?Java LoggingEvent.setMarker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ch.qos.logback.classic.spi.LoggingEvent的用法示例。


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

示例1: testIgnoreMarker

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
@Test
public void testIgnoreMarker() throws NullPointerException, EvaluationException, JoranException {
  JoranConfigurator jc = new JoranConfigurator();
  LoggerContext loggerContext = new LoggerContext();
  jc.setContext(loggerContext);
  jc.doConfigure(ClassicTestConstants.JORAN_INPUT_PREFIX + "ignore.xml");
  
  Map evalMap = (Map) loggerContext.getObject(CoreConstants.EVALUATOR_MAP);
  assertNotNull(evalMap);
  
  Logger logger = loggerContext.getLogger("xx");
  
  JaninoEventEvaluator evaluator = (JaninoEventEvaluator) evalMap.get("IGNORE_EVAL");
  LoggingEvent event = new LoggingEvent("foo", logger, Level.DEBUG, "Hello world",null, null);

  Marker ignoreMarker = MarkerFactory.getMarker("IGNORE");
  event.setMarker(ignoreMarker);
  assertTrue(evaluator.evaluate(event));
  
  logger.debug("hello", new Exception("test"));
  logger.debug(ignoreMarker, "hello ignore", new Exception("test"));
  
  //logger.debug("hello", new Exception("test"));
  
  //StatusPrinter.print(loggerContext.getStatusManager());
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:27,代码来源:EvaluatorJoranTest.java

示例2: match_for_expected_marker

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
@Test
public void match_for_expected_marker() {
  LoggingEvent logEvent = aLoggingEventWith(INFO, "message");
  logEvent.setMarker(MarkerFactory.getMarker("A_MARKER"));

  ExpectedLoggingMessage expectedLoggingMessage = aLog()
    .withMarker(MarkerFactory.getMarker("A_MARKER"));

  boolean matches = expectedLoggingMessage.matches(logEvent);

  assertThat(matches).isTrue();
}
 
开发者ID:mustaine,项目名称:logcapture,代码行数:13,代码来源:ExpectedLoggingMessageShould.java

示例3: match_for_expected_marker_label

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
@Test
public void match_for_expected_marker_label() {
  LoggingEvent logEvent = aLoggingEventWith(INFO, "message");
  logEvent.setMarker(MarkerFactory.getMarker("A_MARKER"));

  ExpectedLoggingMessage expectedLoggingMessage = aLog()
    .withMarker("A_MARKER");

  boolean matches = expectedLoggingMessage.matches(logEvent);

  assertThat(matches).isTrue();
}
 
开发者ID:mustaine,项目名称:logcapture,代码行数:13,代码来源:ExpectedLoggingMessageShould.java

示例4: no_match_for_unexpected_marker

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
@Test
public void no_match_for_unexpected_marker() {
  LoggingEvent logEvent = aLoggingEventWith(INFO, "message");
  logEvent.setMarker(MarkerFactory.getMarker("A_MARKER"));

  ExpectedLoggingMessage expectedLoggingMessage = aLog()
    .withMarker("ANOTHER_MARKER");

  boolean matches = expectedLoggingMessage.matches(logEvent);

  assertThat(matches).isFalse();
}
 
开发者ID:mustaine,项目名称:logcapture,代码行数:13,代码来源:ExpectedLoggingMessageShould.java

示例5: testPassesMetricMarker

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
@Test
public void testPassesMetricMarker() {
    LoggingEvent event = new LoggingEvent();
    event.setMarker(METRIC_MARKER);
    MetricPassFilter filter = new MetricPassFilter();
    filter.start();
    assertEquals(FilterReply.NEUTRAL, filter.decide(event));
}
 
开发者ID:symphoniacloud,项目名称:lambda-monitoring,代码行数:9,代码来源:MetricPassFilterTest.java

示例6: testBlocksNonMetricMarker

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
@Test
public void testBlocksNonMetricMarker() {
    LoggingEvent event = new LoggingEvent();
    event.setMarker(MarkerFactory.getMarker("FOO"));
    MetricPassFilter filter = new MetricPassFilter();
    filter.start();
    assertEquals(FilterReply.DENY, filter.decide(event));
}
 
开发者ID:symphoniacloud,项目名称:lambda-monitoring,代码行数:9,代码来源:MetricPassFilterTest.java

示例7: testBlocksMetricMarker

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
@Test
public void testBlocksMetricMarker() {
    LoggingEvent event = new LoggingEvent();
    event.setMarker(METRIC_MARKER);
    MetricBlockFilter filter = new MetricBlockFilter();
    filter.start();
    assertEquals(FilterReply.DENY, filter.decide(event));
}
 
开发者ID:symphoniacloud,项目名称:lambda-monitoring,代码行数:9,代码来源:MetricBlockFilterTest.java

示例8: testPassesNonMetricMarker

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
@Test
public void testPassesNonMetricMarker() {
    LoggingEvent event = new LoggingEvent();
    event.setMarker(MarkerFactory.getMarker("FOO"));
    MetricBlockFilter filter = new MetricBlockFilter();
    filter.start();
    assertEquals(FilterReply.NEUTRAL, filter.decide(event));
}
 
开发者ID:symphoniacloud,项目名称:lambda-monitoring,代码行数:9,代码来源:MetricBlockFilterTest.java

示例9: buildLoggingEventAndAppend

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
private void buildLoggingEventAndAppend(final String localFQCN,
    final Marker marker, final Level level, final String msg,
    final Object[] params, final Throwable t) {
  LoggingEvent le = new LoggingEvent(localFQCN, this, level, msg, t, params);
  le.setMarker(marker);
  callAppenders(le);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:8,代码来源:Logger.java

示例10: marker

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
@Test
public void marker() throws Exception {
  jee.setExpression("marker.contains(\"BLUE\")");
  jee.start();

  LoggingEvent event = makeLoggingEvent(null);
  event.setMarker(MarkerFactory.getMarker("BLUE"));
  assertTrue(jee.evaluate(event));
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:10,代码来源:JaninoEventEvaluatorTest.java

示例11: testComplex

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
@Test
public void testComplex() throws Exception {
  jee
      .setExpression("level >= INFO && x.matches(message) && marker.contains(\"BLUE\")");
  jee.addMatcher(matcherX);
  jee.start();

  LoggingEvent event = makeLoggingEvent(null);
  event.setMarker(MarkerFactory.getMarker("BLUE"));
  assertTrue(jee.evaluate(event));
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:12,代码来源:JaninoEventEvaluatorTest.java

示例12: createLoggingEvent

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
private LoggingEvent createLoggingEvent(final Level level,
                                        final String message,
                                        final Object... params) {
    final LoggingEvent loggingEvent = new LoggingEvent();
    loggingEvent.setMDCPropertyMap(singletonMap("job_id", "someJobId"));
    loggingEvent.setMessage(message);
    loggingEvent.setArgumentArray(params);
    loggingEvent.setLevel(level);
    loggingEvent.setMarker(JobMarker.JOB);
    return loggingEvent;
}
 
开发者ID:otto-de,项目名称:edison-microservice,代码行数:12,代码来源:JobMessageLogAppenderTest.java

示例13: buildLoggingEventAndAppend

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
private void buildLoggingEventAndAppend(String localFQCN, Marker marker,
                                        Level level, String msg, Object[] params, Throwable t) {
    LoggingEvent le = new KonkerLoggingEvent(localFQCN, this, level, msg, t, params);
    le.setMarker(marker);
    this.callAppenders(le);
}
 
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:7,代码来源:KonkerLogger.java

示例14: createLoggingEvent

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
private ILoggingEvent createLoggingEvent(Marker marker) {
  LoggingEvent le = new LoggingEvent(this.getClass().getName(), lc.getLogger(Logger.ROOT_LOGGER_NAME),
      Level.DEBUG, "test message", null, null);
  le.setMarker(marker);
  return le;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:7,代码来源:MarkerConverterTest.java

示例15: marker

import ch.qos.logback.classic.spi.LoggingEvent; //导入方法依赖的package包/类
@Test
public void marker() throws EvaluationException {
  LoggingEvent event = makeEvent("x");
  event.setMarker(markerA);
  doEvaluateAndCheck("e.marker?.name == 'A'", event, true);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:7,代码来源:GEventEvaluatorTest.java


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