org.apache.logging.log4j.Logger.traceExit()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(213)

本文整理了Java中org.apache.logging.log4j.Logger.traceExit()方法的一些代码示例,展示了Logger.traceExit()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.traceExit()方法的具体详情如下:
包路径:org.apache.logging.log4j.Logger
类名称:Logger
方法名:traceExit

Logger.traceExit介绍

[英]Logs exit from a method. Used for methods that do not return anything.
[中]日志从方法中退出。用于不返回任何内容的方法。

代码示例

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
  public void logger3() {
    logger3.traceEntry();
    logger3.debug(testMarker, "debug message");
    logger3.error("Test Message");
    logger3.info(testMarker, "Info Message");
    logger3.warn("warn Message");
    logger3.traceExit();
    final List<LogEvent> events = app1.getEvents();
    assertEquals("Incorrect number of events. Expected 4, actual " + events.size(), 4, events.size());
  }
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
  public void logger3() {
    logger3.traceEntry();
    logger3.debug(testMarker, "debug message");
    logger3.error("Test Message");
    logger3.info(testMarker, "Info Message");
    logger3.warn("warn Message");
    logger3.traceExit();
    assertThat(app1.getEvents(), hasSize(4));
  }
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void logger2() {
  logger2.traceEntry();
  logger2.debug("debug message");
  logger2.error("Test Message");
  logger2.info("Info Message");
  logger2.warn("warn Message");
  logger2.traceExit();
  assertThat(app1.getEvents(), hasSize(2));
  assertThat(app2.getEvents(), hasSize(4));
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void logger1() {
  logger1.traceEntry();
  logger1.debug("debug message");
  logger1.error("Test Message");
  logger1.info("Info Message");
  logger1.warn("warn Message");
  logger1.traceExit();
  List<LogEvent> events = app1.getEvents();
  assertEquals("Incorrect number of events. Expected 6, actual " + events.size(), 6, events.size());
  events = app2.getEvents();
  assertEquals("Incorrect number of events. Expected 1, actual " + events.size(), 1, events.size());
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void logger2() {
  logger2.traceEntry();
  logger2.debug("debug message");
  logger2.error("Test Message");
  logger2.info("Info Message");
  logger2.warn("warn Message");
  logger2.traceExit();
  List<LogEvent> events = app1.getEvents();
  assertEquals("Incorrect number of events. Expected 2, actual " + events.size(), events.size(), 2);
  events = app2.getEvents();
  assertEquals("Incorrect number of events. Expected 4, actual " + events.size(), events.size(), 4);
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void logger1() {
  logger1.traceEntry();
  logger1.debug("debug message");
  logger1.error("Test Message");
  logger1.info("Info Message");
  logger1.warn("warn Message");
  logger1.traceExit();
  assertThat(app1.getEvents(), hasSize(6));
  assertThat(app2.getEvents(), hasSize(1));
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void basicFlowDeprecated() {
  logger.traceEntry();
  logger.traceExit();
  final List<LogEvent> events = app.getEvents();
  assertEquals("Incorrect number of events. Expected 2, actual " + events.size(), 2, events.size());
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void basicFlow() {
  final EntryMessage entry = logger.traceEntry();
  logger.traceExit(entry);
  final List<LogEvent> events = app.getEvents();
  assertEquals("Incorrect number of events. Expected 2, actual " + events.size(), 2, events.size());
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void testMarkerPatternSelector() throws Exception {
  final org.apache.logging.log4j.Logger logger = LogManager.getLogger("TestMarkerPatternSelector");
  logger.traceEntry();
  logger.info("Hello World");
  logger.traceExit();
  final ListAppender app = (ListAppender) context.getRequiredAppender("List");
  assertNotNull("No ListAppender", app);
  final List<String> messages = app.getMessages();
  assertNotNull("No Messages", messages);
  assertTrue("Incorrect number of messages. Expected 3, Actual " + messages.size() + ": " + messages, messages.size() == 3);
  final String expect = String.format("[TRACE] TestMarkerPatternSelector ====== "
      + "o.a.l.l.c.PatternSelectorTest.testMarkerPatternSelector:43 Enter ======%n");
  assertEquals(expect, messages.get(0));
  assertEquals("[INFO ] TestMarkerPatternSelector Hello World" + Strings.LINE_SEPARATOR, messages.get(1));
  app.clear();
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void testScriptPatternSelector() throws Exception {
  final org.apache.logging.log4j.Logger logger = LogManager.getLogger("TestScriptPatternSelector");
  final org.apache.logging.log4j.Logger logger2 = LogManager.getLogger("NoLocation");
  logger.traceEntry();
  logger.info("Hello World");
  logger2.info("No location information");
  logger.traceExit();
  final ListAppender app = (ListAppender) context.getRequiredAppender("List2");
  assertNotNull("No ListAppender", app);
  final List<String> messages = app.getMessages();
  assertNotNull("No Messages", messages);
  assertTrue("Incorrect number of messages. Expected 4, Actual " + messages.size() + ": " + messages, messages.size() == 4);
  String expect = "[TRACE] TestScriptPatternSelector ====== " +
      "o.a.l.l.c.PatternSelectorTest.testScriptPatternSelector:62 Enter ======" + Strings.LINE_SEPARATOR;
  assertEquals(expect, messages.get(0));
  expect = "[INFO ] TestScriptPatternSelector o.a.l.l.c.PatternSelectorTest.testScriptPatternSelector.63 " +
      "Hello World" + Strings.LINE_SEPARATOR;
  assertEquals(expect, messages.get(1));
  assertEquals("[INFO ] NoLocation No location information" + Strings.LINE_SEPARATOR, messages.get(2));
  app.clear();
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void basicFlow() {
  logger.traceEntry();
  logger.traceExit();
  final List<LogEvent> events = app.getEvents();
  assertEventCount(events, 2);
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void simpleFlow() {
  logger.entry(CONFIG);
  logger.traceExit(0);
  final List<LogEvent> events = app.getEvents();
  assertEventCount(events, 2);
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
  public void testJavaScriptPatternSelector() throws Exception {
    final org.apache.logging.log4j.Logger logger = LogManager.getLogger("TestJavaScriptPatternSelector");
    final org.apache.logging.log4j.Logger logger2 = LogManager.getLogger("JavascriptNoLocation");
    logger.traceEntry();
    logger.info("Hello World");
    logger2.info("No location information");
    logger.traceExit();
    final ListAppender app = (ListAppender) context.getRequiredAppender("List3");
    assertNotNull("No ListAppender", app);
    final List<String> messages = app.getMessages();
    assertNotNull("No Messages", messages);
    assertTrue("Incorrect number of messages. Expected 4, Actual " + messages.size() + ": " + messages, messages.size() == 4);
    String expect = "[TRACE] TestJavaScriptPatternSelector ====== " +
        "o.a.l.l.c.PatternSelectorTest.testJavaScriptPatternSelector:85 Enter ======" + Strings.LINE_SEPARATOR;
    assertEquals(expect, messages.get(0));
    expect = "[INFO ] TestJavaScriptPatternSelector " +
        "o.a.l.l.c.PatternSelectorTest.testJavaScriptPatternSelector.86 Hello World" + Strings.LINE_SEPARATOR;
    assertEquals(expect, messages.get(1));
    assertEquals("[INFO ] JavascriptNoLocation No location information" + Strings.LINE_SEPARATOR, messages.get(2));
    app.clear();
  }
}

代码示例来源:origin: mopemope/meghanada-server

@Override
public void visitAttribute(Attribute attribute) {
 log.traceEntry("attribute={}", attribute);
 super.visitAttribute(attribute);
 log.traceExit();
}

代码示例来源:origin: mopemope/meghanada-server

@Override
public void visitParameter(String s, int i) {
 log.traceEntry("s={} i={}", s, i);
 super.visitParameter(s, i);
 log.traceExit();
}

代码示例来源:origin: mopemope/meghanada-server

@Override
public AnnotationVisitor visitLocalVariableAnnotation(
  int i, TypePath typePath, Label[] labels, Label[] labels1, int[] ints, String s, boolean b) {
 log.traceEntry("i={} s={}", i, s);
 final AnnotationVisitor annotationVisitor =
   super.visitLocalVariableAnnotation(i, typePath, labels, labels1, ints, s, b);
 return log.traceExit(annotationVisitor);
}

代码示例来源:origin: mopemope/meghanada-server

@Override
public SignatureVisitor visitReturnType() {
 final EntryMessage message =
   log.traceEntry("name={} parameterTypes={}", this.name, this.parameterTypes);
 MethodSignatureVisitor visitor = new MethodSignatureVisitor(this.name, this);
 visitor.isReturn = true;
 log.traceExit(message);
 return visitor;
}

代码示例来源:origin: mopemope/meghanada-server

@Override
public SignatureVisitor visitExceptionType() {
 log.traceEntry("current={}", this.current);
 log.traceExit();
 return super.visitExceptionType();
}

代码示例来源:origin: mopemope/meghanada-server

@Override
public void visitFormalTypeParameter(final String s) {
 final EntryMessage message = log.traceEntry("s={} current={}", s, this.current);
 if (this.formalType == null) {
  this.formalType = new TypeInfo("", "");
  this.formalType.typeParameters = new ArrayList<>(4);
  this.formalType.typeParameters.add(new TypeInfo(s, s));
 } else {
  this.formalType.typeParameters.add(new TypeInfo(s, s));
 }
 log.traceExit(message);
}

代码示例来源:origin: mopemope/meghanada-server

private static Optional<SearchCondition> searchFieldAccessCondition(
  Source source, int line, int col, String symbol) {
 EntryMessage msg = log.traceEntry("line={} col={} symbol={}", line, col, symbol);
 Optional<SearchCondition> result =
   source
     .searchFieldAccess(line, col, symbol)
     .map(fa -> new SearchCondition(fa.declaringClass, fa.name, SearchCondition.Type.FIELD));
 log.traceExit(msg);
 return result;
}

相关文章