Search in sources :

Example 31 with EntryMessage

use of org.apache.logging.log4j.message.EntryMessage in project logging-log4j2 by apache.

the class StrictXmlConfigTest method basicFlow.

@Test
public void basicFlow() {
    final EntryMessage entry = logger.traceEntry();
    logger.traceExit(entry);
    final List<LogEvent> events = app.getEvents();
    assertEquals(2, events.size(), "Incorrect number of events. Expected 2, actual " + events.size());
}
Also used : EntryMessage(org.apache.logging.log4j.message.EntryMessage) Test(org.junit.jupiter.api.Test)

Example 32 with EntryMessage

use of org.apache.logging.log4j.message.EntryMessage in project logging-log4j2 by apache.

the class LoggerTest method flowTracingNoArgs.

@Test
public void flowTracingNoArgs() {
    final EntryMessage message = logger.traceEntry();
    logger.traceExit(message);
    assertEquals(2, results.size());
    assertThat("Incorrect Entry", results.get(0), startsWith("ENTER[ FLOW ] TRACE Enter"));
    assertThat("Incorrect Exit", results.get(1), startsWith("EXIT[ FLOW ] TRACE Exit"));
}
Also used : EntryMessage(org.apache.logging.log4j.message.EntryMessage) Test(org.junit.jupiter.api.Test)

Example 33 with EntryMessage

use of org.apache.logging.log4j.message.EntryMessage in project logging-log4j2 by apache.

the class LoggerTest method flowTracingString_ObjectArray2.

@Test
public void flowTracingString_ObjectArray2() {
    final EntryMessage msg = logger.traceEntry("doFoo(a={}, b={})", 1, 2);
    logger.traceExit(msg, 3);
    assertEquals(2, results.size());
    assertThat("Incorrect Entry", results.get(0), startsWith("ENTER[ FLOW ] TRACE Enter"));
    assertThat("Missing entry data", results.get(0), containsString("doFoo(a=1, b=2)"));
    assertThat("Incorrect Exit", results.get(1), startsWith("EXIT[ FLOW ] TRACE Exit"));
    assertThat("Missing exit data", results.get(1), containsString("doFoo(a=1, b=2): 3"));
}
Also used : EntryMessage(org.apache.logging.log4j.message.EntryMessage) Test(org.junit.jupiter.api.Test)

Example 34 with EntryMessage

use of org.apache.logging.log4j.message.EntryMessage in project logging-log4j2 by apache.

the class LoggerTest method flowTracingVoidReturn.

@Test
public void flowTracingVoidReturn() {
    final EntryMessage msg = logger.traceEntry("doFoo(a={}, b={})", 1, 2);
    logger.traceExit(msg);
    assertEquals(2, results.size());
    assertThat("Incorrect Entry", results.get(0), startsWith("ENTER[ FLOW ] TRACE Enter"));
    assertThat("Missing entry data", results.get(0), containsString("doFoo(a=1, b=2)"));
    assertThat("Incorrect Exit", results.get(1), startsWith("EXIT[ FLOW ] TRACE Exit"));
    assertThat("Missing exit data", results.get(1), endsWith("doFoo(a=1, b=2)"));
}
Also used : EntryMessage(org.apache.logging.log4j.message.EntryMessage) Test(org.junit.jupiter.api.Test)

Example 35 with EntryMessage

use of org.apache.logging.log4j.message.EntryMessage in project meghanada-server by mopemope.

the class FieldAnalyzeVisitor method visitEnd.

@Override
public void visitEnd() {
    final EntryMessage m = log.traceEntry("fieldSignature={}", fieldSignature);
    final String modifier = ASMReflector.toModifier(access, false);
    final String fqcn = fieldSignatureVisitor.getResult();
    final FieldDescriptor fd = new FieldDescriptor(this.classAnalyzeVisitor.className, this.name, modifier, fqcn);
    fd.setTypeParameters(fieldSignatureVisitor.getTypeParameters());
    this.classAnalyzeVisitor.getMembers().add(fd);
    log.traceExit(m);
}
Also used : EntryMessage(org.apache.logging.log4j.message.EntryMessage) FieldDescriptor(meghanada.reflect.FieldDescriptor)

Aggregations

EntryMessage (org.apache.logging.log4j.message.EntryMessage)64 ArrayList (java.util.ArrayList)9 CachedASMReflector (meghanada.reflect.asm.CachedASMReflector)8 Test (org.junit.jupiter.api.Test)8 ClassScope (meghanada.analyze.ClassScope)5 MethodCall (meghanada.analyze.MethodCall)5 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Map (java.util.Map)3 Set (java.util.Set)3 ExecutionException (java.util.concurrent.ExecutionException)3 Variable (meghanada.analyze.Variable)3 Project (meghanada.project.Project)3 ClassIndex (meghanada.reflect.ClassIndex)3 ClassNameUtils (meghanada.utils.ClassNameUtils)3 LogManager (org.apache.logging.log4j.LogManager)3 Logger (org.apache.logging.log4j.Logger)3 SignatureReader (org.objectweb.asm.signature.SignatureReader)3