本文整理汇总了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());
}
示例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();
}
示例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();
}
示例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();
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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);
}
示例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));
}
示例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));
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}