Examples of LoggingEvent


Examples of ch.qos.logback.classic.spi.LoggingEvent

                description.appendText("level: ").appendValue(level).appendText(", marker: ").appendValue(marker)
                        .appendText(", text:").appendValue(text);
            }

            public boolean matches(Object o) {
                LoggingEvent event = (LoggingEvent) o;
                return event.getLevel().equals(level) && event.getMessage().equals(text) && event.getMarker() == marker;
            }
        };

        context.checking(new Expectations() {{
            one(appender).doAppend(with(matcher));
View Full Code Here

Examples of ch.qos.logback.classic.spi.LoggingEvent

        MDC.put("FloatField", "2.71828");
        MDC.put("doubleField", "3E-50");
        MDC.put("DoubleField", "3E50");
        MDC.put("foo", "bar");

        LoggingEvent event = new LoggingEvent("my.class.name", logger, Level.INFO, "hello",  null, null);

        GelfConverter converter;
        Map<String, Object> additionalFields;

        // test including full MDC
View Full Code Here

Examples of ch.qos.logback.classic.spi.LoggingEvent

        assertThat(gelfString.contains("\"_marker\""), is(equalTo(useMarker)));
        assertThat(gelfString.contains(markerString), is(equalTo(useMarker)));
    }

    private LoggingEvent createEvent(boolean addMarker) {
        LoggingEvent hello = new LoggingEvent("my.class.name", logger, Level.INFO, "hello", null, null);
        if (addMarker) {
            hello.setMarker(marker);
        }
        return hello;
    }
View Full Code Here

Examples of ch.qos.logback.classic.spi.LoggingEvent

        _mongoDBAppender.start();
    }

    @Test
    public void testLog() {
        LoggingEvent e = new LoggingEvent();
        e.setMessage("log message");
        e.setLevel(Level.DEBUG);
        e.setTimeStamp(System.currentTimeMillis());
        e.setLoggerName("my.logger");
        e.setCallerData(Thread.currentThread().getStackTrace());       
        _mongoDBAppender.append(e);
    }
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

  {
    AdtMessage adtmsg;
    TLogQueue datalog;
   
      Priority priority = null;
      LoggingEvent  event;
      String        fqnOfCategoryClass = "fqnOfCategoryClass";
      Throwable     myThrowable = null;
   
    try{
     
      // convert the JMS message in the Oracle type TLogQueue
      adtmsg = (AdtMessage) JmsMsg;
        datalog =(TLogQueue)(adtmsg.getAdtPayload());
         
          Category logger = Logger.getLogger(datalog.getLuser()+ "." +datalog.getLsection());
         
          // convert the PL/SQL log level in LOG4J level
          Level level = (DynamicLevel)htLevels.get(new Integer (datalog.getLlevel().intValue()));
 
          if (level != null) {
             priority = level;
          } else {
            priority = Level.toLevel("UNDEFINED",  Level.ERROR );
          }   
         
          // create the LOG4J event
          NDC.push("DatabaseLoginDate:"+datalog.getLdate()) ;
          event = new LoggingEvent(fqnOfCategoryClass,
                                   logger,
                                   priority,
                                   datalog.getLtext(),
                                   myThrowable);
 
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

    Throwable t = new UnsupportedOperationException("Test");
    logger.throwing(t);
    logger.throwing(XLogger.Level.DEBUG,t);
    assertEquals(2, listAppender.list.size());
    verifyWithException((LoggingEvent) listAppender.list.get(0), "throwing", t);
    LoggingEvent event = (LoggingEvent)listAppender.list.get(1);
    verifyWithLevelAndException(event, XLogger.Level.DEBUG,
        "throwing", t);
  }
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

    logger.debug("hello");

    assertEquals(2, listAppender.list.size());

    {
      LoggingEvent e = listAppender.list.get(0);
      LocationInfo li = e.getLocationInformation();
      assertEquals(this.getClass().getName(), li.getClassName());
      assertEquals(""+line, li.getLineNumber());
    }
   
    {
      LoggingEvent e = listAppender.list.get(1);
      LocationInfo li = e.getLocationInformation();
      assertEquals(this.getClass().getName(), li.getClassName());
      assertEquals(""+(line+1), li.getLineNumber());
    }

  }
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

    data[1].put("FileName", "/etc/hosts");
    EventLogger.logEvent(data[1]);

    assertEquals(2, listAppender.list.size());
    for (int i=0; i < 2; ++i) {
      LoggingEvent event = listAppender.list.get(i);
      verify(event, data[i].toXML());
      LocationInfo li = event.getLocationInformation();
      assertEquals(this.getClass().getName(), li.getClassName());
      assertEquals(event.getMDC("hostname"), "localhost");
    }
  }
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

  public void testSmoke() {
    SLF4JBridgeHandler.install();
    String msg = "msg";
    julLogger.info(msg);
    assertEquals(1, listAppender.list.size());
    LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
    assertEquals(LOGGER_NAME, le.getLoggerName());
    assertEquals(msg, le.getMessage());

    // get the location info in the event.
    // Note that this must have been computed previously
    // within an appender for the following assertion to
    // work properly
    LocationInfo li = le.getLocationInformation();
    System.out.println(li.fullInfo);
    assertEquals("SLF4JBridgeHandlerTest.java", li.getFileName());
    assertEquals("testSmoke", li.getMethodName());
  }
View Full Code Here

Examples of org.apache.log4j.spi.LoggingEvent

    java.util.logging.Logger julResourceBundleLogger = java.util.logging.Logger
        .getLogger("yay", resourceBundleName);

    julResourceBundleLogger.info(msg);
    assertEquals(1, listAppender.list.size());
    LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
    assertEquals(LOGGER_NAME, le.getLoggerName());
    assertEquals(expectedMsg, le.getMessage());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.