Package org.slf4j.ext

Examples of org.slf4j.ext.XLogger


    assertEquals(t.toString(), le.getThrowableStrRep()[0]);
    assertEquals(le.getLevel().toString(), level.toString());
  }

  public void testEntering() {
    XLogger logger = XLoggerFactory.getXLogger("UnitTest");
    logger.entry();
    logger.entry(1);
    logger.entry("test");
    logger.entry("a", "b", "c", "d");
    logger.entry("a", "b", "c", "d", "e");
    logger.entry("a", "b", "c", "d", "e", "f");

    assertEquals(6, listAppender.list.size());
    verify((LoggingEvent) listAppender.list.get(0), "entry");
    verify((LoggingEvent) listAppender.list.get(1), "entry with (1)");
    verify((LoggingEvent) listAppender.list.get(2), "entry with (test)");
View Full Code Here


    verify((LoggingEvent) listAppender.list.get(1), "entry with (1)");
    verify((LoggingEvent) listAppender.list.get(2), "entry with (test)");
  }

  public void testExiting() {
    XLogger logger = XLoggerFactory.getXLogger("UnitTest");
    logger.exit();
    logger.exit(0);
    logger.exit(false);

    assertEquals(3, listAppender.list.size());
    verify((LoggingEvent) listAppender.list.get(0), "exit");
    verify((LoggingEvent) listAppender.list.get(1), "exit with (0)");
    verify((LoggingEvent) listAppender.list.get(2), "exit with (false)");
View Full Code Here

    verify((LoggingEvent) listAppender.list.get(1), "exit with (0)");
    verify((LoggingEvent) listAppender.list.get(2), "exit with (false)");
  }

  public void testThrowing() {
    XLogger logger = XLoggerFactory.getXLogger("UnitTest");
    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

    verifyWithLevelAndException(event, XLogger.Level.DEBUG,
        "throwing", t);
  }

  public void testCaught() {
    XLogger logger = XLoggerFactory.getXLogger("UnitTest");
    long x = 5;
    Throwable t = null;
    try {
      @SuppressWarnings("unused")
      long y = x / 0;
    } catch (Exception ex) {
      t = ex;
      logger.catching(ex);
      logger.catching(XLogger.Level.DEBUG, ex);
    }
    verifyWithException((LoggingEvent) listAppender.list.get(0), "catching", t);
    verifyWithLevelAndException((LoggingEvent) listAppender.list.get(1), XLogger.Level.DEBUG,
        "catching", t);
  }
View Full Code Here

        "catching", t);
  }

  // See http://bugzilla.slf4j.org/show_bug.cgi?id=114
  public void testLocationExtraction_Bug114() {
    XLogger logger = XLoggerFactory.getXLogger("UnitTest");
    int line = 137; // next line is line number 134
    logger.exit();
    logger.debug("hello");

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

    {
      LoggingEvent e = listAppender.list.get(0);
View Full Code Here

    verify(le, expectedMsg);
    assertEquals(t.toString(), le.getThrowableStrRep()[0]);
  }
 
  public void testEntering() {
    XLogger logger = XLoggerFactory.getXLogger("UnitTest");
    logger.entry();
    logger.entry(1);
    logger.entry("test");

    assertEquals(3, listAppender.list.size());
    verify((LoggingEvent) listAppender.list.get(0), "entry");
    verify((LoggingEvent) listAppender.list.get(1), "entry with (1)");
    verify((LoggingEvent) listAppender.list.get(2), "entry with (test)");
View Full Code Here

    verify((LoggingEvent) listAppender.list.get(1), "entry with (1)");
    verify((LoggingEvent) listAppender.list.get(2), "entry with (test)");
   }

  public void testExiting() {
    XLogger logger = XLoggerFactory.getXLogger("UnitTest");
    logger.exit();
    logger.exit(0);
    logger.exit(false);
   
    assertEquals(3, listAppender.list.size());
    verify((LoggingEvent) listAppender.list.get(0), "exit");
    verify((LoggingEvent) listAppender.list.get(1), "exit with (0)");
    verify((LoggingEvent) listAppender.list.get(2), "exit with (false)");
View Full Code Here

    verify((LoggingEvent) listAppender.list.get(1), "exit with (0)");
    verify((LoggingEvent) listAppender.list.get(2), "exit with (false)");
  }

  public void testThrowing() {
    XLogger logger = XLoggerFactory.getXLogger("UnitTest");
    Throwable t = new UnsupportedOperationException("Test");
    logger.throwing(t);
    assertEquals(1, listAppender.list.size());
    verifyWithException((LoggingEvent) listAppender.list.get(0), "throwing", t);
  }
View Full Code Here

    assertEquals(1, listAppender.list.size());
    verifyWithException((LoggingEvent) listAppender.list.get(0), "throwing", t);
  }

  public void testCaught() {
    XLogger logger = XLoggerFactory.getXLogger("UnitTest");
    long x = 5;
    Throwable t = null;
    try {
      @SuppressWarnings("unused")
      long y = x / 0;
    } catch (Exception ex) {
      t = ex;
      logger.catching(ex);
    }
    verifyWithException((LoggingEvent) listAppender.list.get(0), "catching", t);
  }
View Full Code Here

TOP

Related Classes of org.slf4j.ext.XLogger

Copyright © 2018 www.massapicom. 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.